Re: [go-nuts] TLS dial error pkg variables - Best way to logically detect the type of tls failure

2020-06-07 Thread Matt Harden
I suspect your (possibly wrapped) error will be of type
x509.UnknownAuthorityError, so you should be able to check for it with
errors.As:

var uaerr x509.UnknownAuthorityError
if errors.As(err, ) {
  // handle as an unknown authority error
}

On Tue, Jun 2, 2020 at 8:22 AM Kevin Chadwick  wrote:

> I want my client application to behave differently depending upon whether
> the
> server is down or it is a "x509: certificate signed by unknown authority"
> condition.
>
> It seems there isn't an errors.Is (btw the dot syntax makes it difficult to
> google search!)
>
> I intend to just string match the returned error. However, as it isn't a
> pkg
> variable (had to grep). Does the string fall outside the compatibility
> promise?
>
> If so. Is there a better way or should I just create a test to run on every
> stdlib upgrade?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/f4ddc813-ade5-7501-4fb4-d19dba375a4f%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CALRNMm0JUKmQ_bto3%2B1EpG4odzPYAr0Q%2BjYdytVmoQNp1Tn%3D8Q%40mail.gmail.com.


Re: [go-nuts] Re: Preventing SIGBUS errors when memmove-ing an unsafe.Pointer to multiple destinations

2020-06-07 Thread keith . randall
Showing us some code would really help. It's hard to understand what you 
are doing from this brief description. Also, where does the SIGBUS occur? 
What pc, and what address?

What types are you passing as the first argument to typedmemmove? Where did 
you get them from?

This is a fine question for golang-dev, but don't expect a whole lot of 
help - reaching into the runtime to call typedmemmove is very unsupported.

On Sunday, June 7, 2020 at 10:02:21 AM UTC-7, Michael Jones wrote:
>
> Thank you. I now officially know that I don’t understand. Sorry. 
>
> On Sun, Jun 7, 2020 at 7:54 AM Viktor Kojouharov  > wrote:
>
>> The pointer is being copied via typedmemmove, which itself calls memmove, 
>> which, according to its documentation, copies bytes from the source to the 
>> destination. Not sure why that would be impossible, considering it does 
>> work for some code (the source pointer preserves its data)
>>
>> Not sure what you mean by "copied via unsafe". Also, the source pointer 
>> never goes out of scope. It's part of a struct that is passed to the 
>> function that calls typedmemmove, and its lifetime is more or less static. 
>> So while the destination pointers go out of scope, the source one never 
>> does.
>>
>>
>> On Sunday, June 7, 2020 at 4:45:40 PM UTC+3, Michael Jones wrote:
>>>
>>> Do you mean that you have a problem with the value of the pointer? That 
>>> is "copying the pointer." This seems impossible.
>>>
>>> Attempting to access through a pointer copied via unsafe is (generally) 
>>> inviting doom, and seems highly possible. The instant the last pointer to 
>>> that data goes out of scope the address range occupied by the formerly 
>>> pointed to items is formally inaccessible. Using unsafe to keep a shadow 
>>> copy of the address and then poking around is quite likely to fail, and 
>>> even when it does not, it is quite likely to be meaningless. (random data 
>>> from some other use).
>>>
>>> If I misunderstood, please forgive me.
>>>
>>> On Sun, Jun 7, 2020 at 6:15 AM Viktor Kojouharov  
>>> wrote:
>>>
 p.s. should such questions be posted in golang-dev, since it deals with 
 runtime internals?

 -- 
 You received this message because you are subscribed to the Google 
 Groups "golang-nuts" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to golan...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/golang-nuts/71d7fb5c-3ef5-4611-b9ce-299f7b90945eo%40googlegroups.com
  
 
 .

>>>
>>>
>>> -- 
>>>
>>> *Michael T. jonesmichae...@gmail.com*
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golan...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/fa18bf7e-8965-4917-9d81-00a8f43289c3o%40googlegroups.com
>>  
>> 
>> .
>>
> -- 
>
> *Michael T. jonesmichae...@gmail.com *
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b8d020c8-669f-474e-bebc-05c273470134o%40googlegroups.com.


[go-nuts] Add string Parser to x/tools/stringer

2020-06-07 Thread Diego Augusto Molina
Very often I use the stringer command to generate lists of enumerated 
values, which is great btw.
But one thing that I see myself also writing after this is a Parse method 
or function to validate strings that are received.
The use case is that I have a list of possible values for a controlled 
field in a RESTful API. I receive and deliver string values from the API by 
I have a tight control inside the API itself.
I declare a new type (generally an uint8 alias) and then declare a bunch of 
auto incremental constants, starting with the zero value that I always set 
to "Invalid" which is used as a control value.
The stringer command makes the dull work but immediately after I write a 
Parse function or method. The following is a full example:
//go:generate stringer -linecomment -output=enum_string.go -type=MyEnum
package enum

type MyEnum uint8

const (
// Reserved for internal use
MyEnumInvalid MyEnum = iota // Invalid

MyEnumValue1 // Value #1
MyEnumValue2 // Value #2
MyEnumValue3 // Value #3
MyEnumValue4 // Value #4
MyEnumValue5 // Value #5
)

func (e *MyEnum) Parse(value string) MyEnum {
for lenIdx, lenVal, i := len(_MyEnum_index), uint8(len(value)), 1; i < 
lenIdx; i++ {
if _MyEnum_index[i]-_MyEnum_index[i-1] == lenVal && // Maybe too 
small optimization to be perceptible/useful(?)
_MyEnum_name[_MyEnum_index[i-1]:_MyEnum_index[i]] == value {
*e = MyEnum(i - 1)
return *e
}
}
return MyEnum(0)
}

So this couples a lot to my workflow, of course. This way I can do 
something like:
receivedVal = new(MyEnum).Parse(receivedStr)
Or:
var val *MyEnum
for _, strVal := range strValues {
if val.Parse(strVal) == MyEnumInvalid {
return fmt.Errorf("Invalid value for enum: %v", strVal)
}
}

So I started to write this function within the stringer command, which I 
modified to do so. So I don't know if this is for some use to the 
community. I know that in order for it to be useful to everyone it should 
be more general. So I'm looking at alternatives and, of course, if it's 
worth working on that. I it would be of some use there are two alternatives 
where this could live:

   - As an option to the stringer command
   - As a separate command (because it would exceed the stringer interface 
   and would be misleading, since "Parse" is not part of the "Stringer" 
   interface)

And I'm only using here the stringer command to create series of 
consecutive numbers, so I would need to write extra code to fulfill the 
sparsiness of values (cases where stringer creates up to 10 different 
slices and after that just creates a map). It wouldn't be much work, 
actually, just read the code in the command.
And instead of writing a new method for the type (breaking the idea of the 
"stringer" interface), I thought it could just be a "ParseT" function.

Thoughts? Comments? Should I keep it for myself (hahaha)?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8b1d284c-9874-4e36-8883-a61c8eb218e7o%40googlegroups.com.


Re: [go-nuts] Re: Preventing SIGBUS errors when memmove-ing an unsafe.Pointer to multiple destinations

2020-06-07 Thread Michael Jones
Thank you. I now officially know that I don’t understand. Sorry.

On Sun, Jun 7, 2020 at 7:54 AM Viktor Kojouharov 
wrote:

> The pointer is being copied via typedmemmove, which itself calls memmove,
> which, according to its documentation, copies bytes from the source to the
> destination. Not sure why that would be impossible, considering it does
> work for some code (the source pointer preserves its data)
>
> Not sure what you mean by "copied via unsafe". Also, the source pointer
> never goes out of scope. It's part of a struct that is passed to the
> function that calls typedmemmove, and its lifetime is more or less static.
> So while the destination pointers go out of scope, the source one never
> does.
>
>
> On Sunday, June 7, 2020 at 4:45:40 PM UTC+3, Michael Jones wrote:
>>
>> Do you mean that you have a problem with the value of the pointer? That
>> is "copying the pointer." This seems impossible.
>>
>> Attempting to access through a pointer copied via unsafe is (generally)
>> inviting doom, and seems highly possible. The instant the last pointer to
>> that data goes out of scope the address range occupied by the formerly
>> pointed to items is formally inaccessible. Using unsafe to keep a shadow
>> copy of the address and then poking around is quite likely to fail, and
>> even when it does not, it is quite likely to be meaningless. (random data
>> from some other use).
>>
>> If I misunderstood, please forgive me.
>>
>> On Sun, Jun 7, 2020 at 6:15 AM Viktor Kojouharov 
>> wrote:
>>
>>> p.s. should such questions be posted in golang-dev, since it deals with
>>> runtime internals?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golan...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/golang-nuts/71d7fb5c-3ef5-4611-b9ce-299f7b90945eo%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>>
>> *Michael T. jonesmichae...@gmail.com*
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/fa18bf7e-8965-4917-9d81-00a8f43289c3o%40googlegroups.com
> 
> .
>
-- 

*Michael T. jonesmichael.jo...@gmail.com *

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CALoEmQyBHzkKdYQ_7HF%3DQhmg5na2PZfhi0QmMkOtXY-%3Dh5u3vw%40mail.gmail.com.


Re: [go-nuts] Re: developing local packages with modules

2020-06-07 Thread Erwin
Yes Brian, this the way it is done in the "How to write Go code" article,
and it indeed works. At least, when package
morestrings is imported in the hello module where it is part of. I did get
that to work, but... i wanted to take the next
step and import that package morestrings in a whole new module, let's call
it hello2. I can't get that to work without
actually creating a real repository and getting it from there. Or, i am now
finding out, after editing my .mod file to use
replace. I had hoped there would be a way to not have to manually edit the
.mod files. Go development used to be
so beautifully simple!



On Sun, 7 Jun 2020 at 16:07, Brian Candler  wrote:

> On Sunday, 7 June 2020 14:20:40 UTC+1, Erwin Driessens wrote:
>>
>>
>> However, my next quest was to import the hello/morestrings package in
>> another module and use it there. I can['t] get it to work :(
>> Does anyone know of a good document/wiki/tutorial about developing go
>> code that is not on remote repositories?  Go was great but now i feel
>> totally handicapped...
>>
>>
> If you used "github.com/me/hello" as the base project, then use "
> github.com/me/hello/morestrings" for the sub-package in the "morestrings"
> subdirectory.
>
> ==> go.mod <==
> module github.com/me/hello
>
> go 1.14
>
> ==> main.go <==
> package main
>
> import (
> "fmt"
> "github.com/me/hello/morestrings"
> )
>
> func main() {
> fmt.Println(morestrings.Greeting)
> }
>
> ==> morestrings/strings.go <==
> package morestrings
>
> const Greeting = "Hello, world!"
>
> Result:
>
> $ go build
> $ ./hello
> Hello, world!
> $
>
> Note: you don't need to use "package morestrings" inside the "morestrings"
> directory - this is just a convention. The "import" statement points to the
> directory, but the package defined in that directory can have any name.
> The following also works:
>
> ==> go.mod <==
> module github.com/me/hello
>
> go 1.14
>
> ==> main.go <==
> package main
>
> import (
> "fmt"
> "github.com/me/hello/morestrings"
> )
>
> func main() {
> fmt.Println(wibble.Greeting)
> }
>
> ==> morestrings/strings.go <==
> package wibble
>
> const Greeting = "Hello, world!"
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/9-5aDopSGvo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/7627c8fd-9b17-4863-88aa-d278c70d8106o%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2BJLj4znXG6aP6gTP04upeRXp4wMF7y2nNgGY93N6BcNKD7Hgg%40mail.gmail.com.


Re: [go-nuts] Re: Preventing SIGBUS errors when memmove-ing an unsafe.Pointer to multiple destinations

2020-06-07 Thread Viktor Kojouharov
The pointer is being copied via typedmemmove, which itself calls memmove, 
which, according to its documentation, copies bytes from the source to the 
destination. Not sure why that would be impossible, considering it does 
work for some code (the source pointer preserves its data)

Not sure what you mean by "copied via unsafe". Also, the source pointer 
never goes out of scope. It's part of a struct that is passed to the 
function that calls typedmemmove, and its lifetime is more or less static. 
So while the destination pointers go out of scope, the source one never 
does.


On Sunday, June 7, 2020 at 4:45:40 PM UTC+3, Michael Jones wrote:
>
> Do you mean that you have a problem with the value of the pointer? That is 
> "copying the pointer." This seems impossible.
>
> Attempting to access through a pointer copied via unsafe is (generally) 
> inviting doom, and seems highly possible. The instant the last pointer to 
> that data goes out of scope the address range occupied by the formerly 
> pointed to items is formally inaccessible. Using unsafe to keep a shadow 
> copy of the address and then poking around is quite likely to fail, and 
> even when it does not, it is quite likely to be meaningless. (random data 
> from some other use).
>
> If I misunderstood, please forgive me.
>
> On Sun, Jun 7, 2020 at 6:15 AM Viktor Kojouharov  > wrote:
>
>> p.s. should such questions be posted in golang-dev, since it deals with 
>> runtime internals?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golan...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/71d7fb5c-3ef5-4611-b9ce-299f7b90945eo%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
>
> *Michael T. jonesmichae...@gmail.com *
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/fa18bf7e-8965-4917-9d81-00a8f43289c3o%40googlegroups.com.


[go-nuts] Re: developing local packages with modules

2020-06-07 Thread Brian Candler
On Sunday, 7 June 2020 14:20:40 UTC+1, Erwin Driessens wrote:
>
>
> However, my next quest was to import the hello/morestrings package in 
> another module and use it there. I can['t] get it to work :(
> Does anyone know of a good document/wiki/tutorial about developing go code 
> that is not on remote repositories?  Go was great but now i feel totally 
> handicapped...
>
>
If you used "github.com/me/hello" as the base project, then use 
"github.com/me/hello/morestrings" for the sub-package in the "morestrings" 
subdirectory.

==> go.mod <==
module github.com/me/hello

go 1.14

==> main.go <==
package main

import (
"fmt"
"github.com/me/hello/morestrings"
)

func main() {
fmt.Println(morestrings.Greeting)
}

==> morestrings/strings.go <==
package morestrings

const Greeting = "Hello, world!"

Result:

$ go build
$ ./hello
Hello, world!
$ 

Note: you don't need to use "package morestrings" inside the "morestrings" 
directory - this is just a convention. The "import" statement points to the 
directory, but the package defined in that directory can have any name.  
The following also works:

==> go.mod <==
module github.com/me/hello

go 1.14

==> main.go <==
package main

import (
"fmt"
"github.com/me/hello/morestrings"
)

func main() {
fmt.Println(wibble.Greeting)
}

==> morestrings/strings.go <==
package wibble

const Greeting = "Hello, world!"

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/7627c8fd-9b17-4863-88aa-d278c70d8106o%40googlegroups.com.


Re: [go-nuts] Re: Preventing SIGBUS errors when memmove-ing an unsafe.Pointer to multiple destinations

2020-06-07 Thread Michael Jones
Do you mean that you have a problem with the value of the pointer? That is
"copying the pointer." This seems impossible.

Attempting to access through a pointer copied via unsafe is (generally)
inviting doom, and seems highly possible. The instant the last pointer to
that data goes out of scope the address range occupied by the formerly
pointed to items is formally inaccessible. Using unsafe to keep a shadow
copy of the address and then poking around is quite likely to fail, and
even when it does not, it is quite likely to be meaningless. (random data
from some other use).

If I misunderstood, please forgive me.

On Sun, Jun 7, 2020 at 6:15 AM Viktor Kojouharov 
wrote:

> p.s. should such questions be posted in golang-dev, since it deals with
> runtime internals?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/71d7fb5c-3ef5-4611-b9ce-299f7b90945eo%40googlegroups.com
> 
> .
>


-- 

*Michael T. jonesmichael.jo...@gmail.com *

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CALoEmQwf4wL3TPdh5yi0hU5ibJaN7-35SsQgGfGLTRAaEjihMA%40mail.gmail.com.


Re: [go-nuts] developing local packages with modules

2020-06-07 Thread Erwin
Thanks Micheal, i will read those articles.
But won't it be very cumbersome to have to edit the go.mod file all the
time? It seems like it would break the flow.



On Sun, 7 Jun 2020 at 15:31, Michael Stiller  wrote:

> Hi,
>
> if the you want to use is on the local system you can add something like
> this to the go.mod file:
>
> replace github.com/yourrepo/module  => ../pkg/module
>
> See also here:
>
>
> https://thewebivore.com/using-replace-in-go-mod-to-point-to-your-local-module/
>
> and here:
>
> https://starkandwayne.com/blog/switching-to-go-modules/
>
> Best regards,
>
> Michael
>
>
> > On 7. Jun 2020, at 15:20, Erwin Driessens  wrote:
> >
> > Hello people
> > i have always found modules very scary and complicated but now there
> seems to be no way round any longer.
> > I have a lot of packages that i do now want to put in repositories. I
> want them to be locally accessible, without internet access.
> > Everything always worked great for me with the old GOPATH setup.
> > Yesterday i installed go 1.14 on a new machine, and thought, ok lets try
> the modules. I followed "How to write Go code" (
> https://golang.org/doc/code.html) and was happy to read the following:
> > "
> > Note that you don't need to publish your code to a remote repository
> before you can build it. A module can be defined locally without belonging
> to a repository. However, it's a good habit to organize your code as if you
> will publish it someday.
> > "
> > I did indeed get the hello module to work well.
> >
> > However, my next quest was to import the hello/morestrings package in
> another module and use it there. I can get it to work :(
> > Does anyone know of a good document/wiki/tutorial about developing go
> code that is not on remote repositories?  Go was great but now i feel
> totally handicapped...
> >
> >
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to golang-nuts+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/186c785e-f328-439b-a8e5-87f6f0faba90o%40googlegroups.com
> .
>
> --
> 2scale GmbH, Schanzenstr. 20, 40549 Düsseldorf
> Amtsgericht:Düsseldorf HRB 50718
> Geschäftsführer:Georg von Zezschwitz, Dirk Vleugels
> USt-IdNr.:  DE 210936505
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2BJLj4xQTAY_1%3DQL3aCbus9hC4U_WGeWP5HPvteMHS1YoywSxg%40mail.gmail.com.


[go-nuts] Re: developing local packages with modules

2020-06-07 Thread Erwin Driessens
should be: "i can't get it to work", instead of "i can get it to work", 
sadly enough


On Sunday, June 7, 2020 at 3:20:40 PM UTC+2, Erwin Driessens wrote:
>
> Hello people
> i have always found modules very scary and complicated but now there seems 
> to be no way round any longer.
> I have a lot of packages that i do now want to put in repositories. I want 
> them to be locally accessible, without internet access. 
> Everything always worked great for me with the old GOPATH setup. 
> Yesterday i installed go 1.14 on a new machine, and thought, ok lets try 
> the modules. I followed "How to write Go code" (
> https://golang.org/doc/code.html) and was happy to read the following:
> "
> Note that you don't need to publish your code to a remote repository 
> before you can build it. A module can be defined locally without belonging 
> to a repository. However, it's a good habit to organize your code as if you 
> will publish it someday.
> "
> I did indeed get the hello module to work well.
>
> However, my next quest was to import the hello/morestrings package in 
> another module and use it there. I can get it to work :(
> Does anyone know of a good document/wiki/tutorial about developing go code 
> that is not on remote repositories?  Go was great but now i feel totally 
> handicapped...
>
>  
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/66770ecc-db3a-4b7f-8309-c5b9e910605co%40googlegroups.com.


Re: [go-nuts] developing local packages with modules

2020-06-07 Thread 'Michael Stiller' via golang-nuts
Hi,

if the you want to use is on the local system you can add something like this 
to the go.mod file:

replace github.com/yourrepo/module  => ../pkg/module

See also here:

https://thewebivore.com/using-replace-in-go-mod-to-point-to-your-local-module/

and here:

https://starkandwayne.com/blog/switching-to-go-modules/

Best regards,

Michael


> On 7. Jun 2020, at 15:20, Erwin Driessens  wrote:
> 
> Hello people
> i have always found modules very scary and complicated but now there seems to 
> be no way round any longer.
> I have a lot of packages that i do now want to put in repositories. I want 
> them to be locally accessible, without internet access. 
> Everything always worked great for me with the old GOPATH setup. 
> Yesterday i installed go 1.14 on a new machine, and thought, ok lets try the 
> modules. I followed "How to write Go code" (https://golang.org/doc/code.html) 
> and was happy to read the following:
> "
> Note that you don't need to publish your code to a remote repository before 
> you can build it. A module can be defined locally without belonging to a 
> repository. However, it's a good habit to organize your code as if you will 
> publish it someday.
> "
> I did indeed get the hello module to work well.
> 
> However, my next quest was to import the hello/morestrings package in another 
> module and use it there. I can get it to work :(
> Does anyone know of a good document/wiki/tutorial about developing go code 
> that is not on remote repositories?  Go was great but now i feel totally 
> handicapped...
> 
>  
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/186c785e-f328-439b-a8e5-87f6f0faba90o%40googlegroups.com.

-- 
2scale GmbH, Schanzenstr. 20, 40549 Düsseldorf
Amtsgericht:Düsseldorf HRB 50718
Geschäftsführer:Georg von Zezschwitz, Dirk Vleugels
USt-IdNr.:  DE 210936505





-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/DE42BBA0-5C6E-494E-AEAF-77FCECD2028B%402scale.net.


[go-nuts] developing local packages with modules

2020-06-07 Thread Erwin Driessens
Hello people
i have always found modules very scary and complicated but now there seems 
to be no way round any longer.
I have a lot of packages that i do now want to put in repositories. I want 
them to be locally accessible, without internet access. 
Everything always worked great for me with the old GOPATH setup. 
Yesterday i installed go 1.14 on a new machine, and thought, ok lets try 
the modules. I followed "How to write Go code" (
https://golang.org/doc/code.html) and was happy to read the following:
"
Note that you don't need to publish your code to a remote repository before 
you can build it. A module can be defined locally without belonging to a 
repository. However, it's a good habit to organize your code as if you will 
publish it someday.
"
I did indeed get the hello module to work well.

However, my next quest was to import the hello/morestrings package in 
another module and use it there. I can get it to work :(
Does anyone know of a good document/wiki/tutorial about developing go code 
that is not on remote repositories?  Go was great but now i feel totally 
handicapped...

 



-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/186c785e-f328-439b-a8e5-87f6f0faba90o%40googlegroups.com.


[go-nuts] Re: Preventing SIGBUS errors when memmove-ing an unsafe.Pointer to multiple destinations

2020-06-07 Thread Viktor Kojouharov
p.s. should such questions be posted in golang-dev, since it deals with 
runtime internals?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/71d7fb5c-3ef5-4611-b9ce-299f7b90945eo%40googlegroups.com.


[go-nuts] Preventing SIGBUS errors when memmove-ing an unsafe.Pointer to multiple destinations

2020-06-07 Thread Viktor Kojouharov
Hi,

I'm playing around with the runtime, copying some data behind 
unsafe.Pointer to a destination whenever a function is invoked. I'm 
currently doing it with the 'typedmemmove' function from within the 
runtime. That works for certain code, but panics with "unexpected fault 
address" - going through sigpanic and SIGBUS - with another piece of code. 
More specifically, the code panics on the second copy, as the first one is 
fine. Is the panic because the source pointer has been garbage collected 
somehow? How would I go about figuring out what the underlying cause is, 
and depending on that, work to fix it?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f8d6fddf-b675-4c71-a899-3d2ed21c0bfbo%40googlegroups.com.