Re: [go-nuts] How to use build tags with go run

2020-09-13 Thread Gert
gt; > On Sun, Sep 13, 2020 at 8:07 PM Gert wrote: > >> // +build local >> >> This works for >> go build -tags local >> go test -tags local >> >> But for some reason go run ignores the local tag? >> go run . -tags local >> >> --

[go-nuts] How to use build tags with go run

2020-09-13 Thread Gert
// +build local This works for go build -tags local go test -tags local But for some reason go run ignores the local tag? go run . -tags local -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] var fn myHandler = func(){ fn }

2020-07-12 Thread Gert
On Sunday, July 12, 2020 at 9:33:43 PM UTC+2 ba...@iitbombay.org wrote: > The issue is that fn's type can't be completely determined until > the RHS func is fully analyzed but for that to work fn must be > known! This is not a problem when a "const" function references > itself as in `func

[go-nuts] var fn myHandler = func(){ fn }

2020-07-12 Thread Gert
https://play.golang.org/p/6xMgjr1IyFD var fn myHandler fn = func(w http.ResponseWriter, r *http.Request) { fn.GET(w, r) } Just wondering if it's possible somehow to write this in one line like so var fn myHandler = func(w http.ResponseWriter, r *http.Request) { fn.GET(w, r) } and if that

[go-nuts] [generics] go vet -generic flag

2020-06-18 Thread Gert
As far as I can tell there are already a lot of closed working as intended tickets related to https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#using-generic-types-as-unnamed-function-parameter-types My suggestion is to be more proactive about this

Re: [go-nuts] [generics] another parsing ambiguity

2020-06-17 Thread Gert
Thanks, can you maybe at the complete working code snippet in your issue too ``` type R(type T) struct{} func F(type T)() { _ = func() (_ R(T)) { return R(T){} } } ``` I think it's not trivial code even after reading the issue what your solution was to the problem. -- You received this

Re: [go-nuts] [generics] another parsing ambiguity

2020-06-17 Thread Gert
At Ben did you made a github issue yet for it? Can't seem to find it https://github.com/golang/go/issues?q=is%3Aissue+cmd%2Fgo2go 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

Re: [go-nuts] Re: Trampoline example

2020-05-09 Thread Gert
On Sunday, May 10, 2020 at 12:33:08 AM UTC+2, Ian Lance Taylor wrote: > > On Sat, May 9, 2020 at 12:56 PM Gert > > wrote: > > > > This is the closest I get, I am out of ideas. Don't know why it runs but > doesn't update the string. > > I don't know what y

[go-nuts] Re: Trampoline example

2020-05-09 Thread Gert
This is the closest I get, I am out of ideas. Don't know why it runs but doesn't update the string. go run . test [116 101 115 116 0 0 0 0 0 0] 4 0 0 #include #include int hello(char *s) { char c[80]; strcpy (c, s); sprintf(s, "hello %s", c); printf("--\n"); return 0; } #include

[go-nuts] Re: Why I fear Go

2020-05-09 Thread Gert
On Saturday, May 9, 2020 at 7:57:23 PM UTC+2, shammah Zealsham Agwor wrote: > > I have been programming since 2016 but I have never really dived deep into > any language and haven't got a job with any . I decided to change all that > and focus with every soul in me on golang. But I have my fear

[go-nuts] Re: Trampoline example

2020-05-09 Thread Gert
I am getting it to compile and run with this but I am struggling how you send a string pointer across a syscall that c can send back. Also not sure about the //go:nosplit I sprinkel around which one is actually right? package main import ( "syscall" "unsafe" "golang.org/x/sys/unix" )

[go-nuts] Trampoline example

2020-05-09 Thread Gert
Hi, this is the smallest example I can think of but I have know idea how I am suppose to do the syscall and trampoline part? ./c/hello.c - #include #include int hello(char *s) { char c[80]; strcpy (c, s); sprintf(s, "hello %s", c); return 0; } clang -shared -fpic hello.c -o

Re: [go-nuts] C datagram recvfrom unix domain socket

2020-02-15 Thread Gert
On Sunday, February 16, 2020 at 1:20:11 AM UTC+1, Gert wrote: > > Your are right about sendto, when I remove the connect part before the > sendto, I get the exact same as the very first attempt where the server > receives the message but can't send anything back. > &

Re: [go-nuts] C datagram recvfrom unix domain socket

2020-02-15 Thread Gert
or don’t Connect(). > > When you “Connect” you are connecting the socket which controls the > destination for packets. > > On Feb 15, 2020, at 5:25 PM, Gert > > wrote: > > Another attempt but now I get `socket is already connected` > > https://play.golang.org/p/-klJZP

Re: [go-nuts] C datagram recvfrom unix domain socket

2020-02-15 Thread Gert
Another attempt but now I get `socket is already connected` https://play.golang.org/p/-klJZPnKFRk On Saturday, February 15, 2020 at 8:53:46 PM UTC+1, Gert wrote: > > Thx when looking for Recv() and Send() I found this package > https://pkg.go.dev/golang.org/x/sys/unix > > I d

Re: [go-nuts] C datagram recvfrom unix domain socket

2020-02-15 Thread Gert
w level Unix interfaces. > > On Feb 15, 2020, at 9:22 AM, Gert > > wrote: > >  > Hi, leaving out a lot of details I basically do this in a C client > > fd = socket(PF_UNIX, SOCK_DGRAM, 0) > bind(fd, (struct sockaddr*) , sizeof(struct sockaddr_un) > connect(fd, (st

[go-nuts] C datagram recvfrom unix domain socket

2020-02-15 Thread Gert
Hi, leaving out a lot of details I basically do this in a C client fd = socket(PF_UNIX, SOCK_DGRAM, 0) bind(fd, (struct sockaddr*) , sizeof(struct sockaddr_un) connect(fd, (struct sockaddr*) , sizeof(struct sockaddr_un) send(fd, buff, strlen(buff)+1, 0) recv(fd, buff, 8192, 0) Which means I have

Re: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread Gert Cuykens
Ok thanks, I will try that but don't think it will be elegant for turning on and off plain json in a code base, because I have to change every json.Marshal and json.Umarshal On Fri, Dec 27, 2019 at 10:21 AM Dan Kortschak wrote: > > MarshalText? > > On Fri, 2019-12-27 at 09:51 +0100,

Re: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread Gert Cuykens
if your encrypted bytes contain quotes, that'll > be problematic). > > On Fri, Dec 27, 2019 at 7:55 AM Gert wrote: >> >> https://play.golang.org/p/6qKkJhVsnU1 >> >> type Payload struct{} >> >> func (p Payload) MarshalJSON() ([]byte, error) { >>

[go-nuts] MarshalJSON() output encrypted json

2019-12-26 Thread Gert
https://play.golang.org/p/6qKkJhVsnU1 type Payload struct{} func (p Payload) MarshalJSON() ([]byte, error) { return []byte("my custom encryption stuf"), nil } func main() { p := Payload{} j, err := json.Marshal(p) if err != nil { fmt.Println(err) } fmt.Println(string(j)) } json: error calling

Re: [go-nuts] slice pointer to type Token []byte

2019-12-25 Thread Gert
On Thursday, December 26, 2019 at 4:33:23 AM UTC+1, burak serdar wrote: > > On Wed, Dec 25, 2019 at 8:05 PM Gert > > wrote: > > > > Is there a cleaner way to write the > > > > s:= *t > > *t = s[i+1:] > > > > part? > > > &g

[go-nuts] slice pointer to type Token []byte

2019-12-25 Thread Gert
Is there a cleaner way to write the s:= *t *t = s[i+1:] part? was hoping for something like *t = *t[i+1:] type Token []byte func (t *Token) Next() bool { if i := bytes.IndexByte(*t, '.'); i > -1 { s := *t *t = s[i+1:] return true } return false } func (t Token) String() string { if i :=

[go-nuts] Re: How do you escape a dot in a /usr/local/go/src/cmd/go/testdata/script pattern

2019-12-17 Thread Gert
never mind, just plain regex \[ \. On Wednesday, December 18, 2019 at 2:38:52 AM UTC+1, Gert wrote: > > > https://go-review.googlesource.com/c/go/+/201857/7/src/cmd/go/testdata/script/doc.txt > > go test cmd/go -run=Script/^doc$ > > I guess this fails because of a dot locat

[go-nuts] How do you escape a dot in a /usr/local/go/src/cmd/go/testdata/script pattern

2019-12-17 Thread Gert
https://go-review.googlesource.com/c/go/+/201857/7/src/cmd/go/testdata/script/doc.txt go test cmd/go -run=Script/^doc$ I guess this fails because of a dot located in the pattern 'go doc [.]' How do you escape it? -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: [64]byte()[:]

2019-11-15 Thread Gert
On Saturday, November 16, 2019 at 4:32:32 AM UTC+1, Gert wrote: > Is it possible to write this without creating a separate var b64 first? > Basically just write it in one line? > > var b64 [64]byte // 64 zero bytes > if bytes.Equal(b64[:], x) {} > > if bytes.Equal(make([]byt

[go-nuts] [64]byte()[:]

2019-11-15 Thread Gert
Is it possible to write this without creating a separate var b64 first? Basically just write it in one line? var b64 [64]byte // 64 zero bytes if bytes.Equal(b64[:], x) {} -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

[go-nuts] Re: go vet output

2019-10-30 Thread Gert
I think it needs to be fixed here somewhere? go/src/cmd/go/internal/work On Saturday, October 26, 2019 at 1:47:24 PM UTC+2, Gert wrote: > > Stuck :( I am lost in a jungle of source code looking for `Report` > printers > > On Saturday, October 26, 2019 at 1:33:29 PM UT

Re: [go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-27 Thread Gert
On Sunday, October 27, 2019 at 9:54:29 AM UTC+1, rog wrote: > > > On Sun, 27 Oct 2019, 00:04 Gert, > wrote: > >> I believe it's going to be to hard to write a go vet analyser that could >> warn to detect unintended state change on a array from two different >> p

Re: [go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread Gert
On Saturday, October 26, 2019 at 10:22:42 PM UTC+2, atd...@gmail.com wrote: > > > On Saturday, October 26, 2019 at 9:47:39 PM UTC+2, Ian Lance Taylor wrote: >> >> On Sat, Oct 26, 2019 at 10:50 AM atd...@gmail.com >> wrote: >> > >> > I get that we can do that but it's not strictly about slices

[go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread Gert
sue is not really about append but can be illustrated by this : > > https://play.golang.org/p/YZlo1mqGDLz > > On Saturday, October 26, 2019 at 2:27:06 PM UTC+2, Gert wrote: >> >> Sorry, the performance cost is to high. But you can practice a few >> programming habits that can p

[go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-26 Thread Gert
Sorry, the performance cost is to high. But you can practice a few programming habits that can prevent this, like use x = append(x, y) and never x = append(y, x) Basically we only need a Go proverb bible mentioned in one of Rob Pike's talks and we will be fine :) On Saturday, October 26, 2019

[go-nuts] Re: go vet output

2019-10-26 Thread Gert
Stuck :( I am lost in a jungle of source code looking for `Report` printers On Saturday, October 26, 2019 at 1:33:29 PM UTC+2, Gert wrote: > > A no wait need to go other direction and find all type Pass structs > > pass.Report(Diagnostic{Pos: pos, Message: msg}) > > On Saturday

[go-nuts] Re: go vet output

2019-10-26 Thread Gert
A no wait need to go other direction and find all type Pass structs pass.Report(Diagnostic{Pos: pos, Message: msg}) On Saturday, October 26, 2019 at 1:23:40 PM UTC+2, Gert wrote: > > > https://github.com/golang/tools/blob/master/go/analysis/analysis.go#L161-L173 > > Can I assu

[go-nuts] Re: go vet output

2019-10-26 Thread Gert
https://github.com/golang/tools/blob/master/go/analysis/analysis.go#L161-L173 Can I assume every output of go vet passes through here? So basically need to figure out all the references to this two functions and change the format? On Saturday, October 26, 2019 at 12:59:59 PM UTC+2, Gert wrote

[go-nuts] go vet output

2019-10-26 Thread Gert
https://github.com/golang/go/issues/24344#issuecomment-546589062 The start of the go vet rabbit hole is this right? https://github.com/golang/go/blob/master/src/cmd/vet/main.go So basically one of does or all of the analyzers is responsible for the print output right? So if i want to fix it i

[go-nuts] Re: errors custom As

2019-10-24 Thread Gert
done with Unwrap like this: > https://play.golang.org/p/v4gDgtlNxcQ > > Good luck. > > > On Thursday, October 24, 2019 at 4:26:25 AM UTC-4, Gert wrote: >> >> Hi, I fail to understand how the custom As is suppose to work? >> >> see example https://play.gol

[go-nuts] Re: Roadblock for user-implemented JIT compiler

2019-10-24 Thread Gert
This kind of low level is way out of my league but what about using https://github.com/tinygo-org/tinygo instead to build your JIT? I only know tinygo has no garbage collector at all. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] errors custom As

2019-10-24 Thread Gert
Hi, I fail to understand how the custom As is suppose to work? see example https://play.golang.org/p/tjuItX5dHoJ -- 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

[go-nuts] Re: Empty go.mod file in root directory containing only version maps

2019-10-22 Thread Gert
Thanks, the branch approach makes much more sense https://github.com/gertcuykens/module/tree/v5.0.0 On Tuesday, October 22, 2019 at 5:03:26 PM UTC+2, t hepudds wrote: > > Hello Gert, > > It looks like you are experimenting with the "major subdirectory" layout > for m

[go-nuts] Empty go.mod file in root directory containing only version maps

2019-10-22 Thread Gert
Example https://github.com/gertcuykens/module/tree/v4.0.0 can I assume it to be good practice to put a empty go.mod file in the root directory that doesn't contain other go files, only the version folders, so the root itself doesn't get recognised as a module itself? -- You received this

[go-nuts] flag.PrintDefaults() messes up flags description new lines ?

2019-10-17 Thread Gert
Compared to go help doc output, it seems flag.PrintDefaults() messes up flags descriptions of go doc --help ? go doc --help Usage of [go] doc: go doc go doc go doc [.] go doc [].[.] go doc [.] For more information run go help doc Flags: -all show all documentation for package -c symbol

[go-nuts] Re: net: conn.WriteToUDP([]byte("not ok"), addr)

2019-10-09 Thread Gert
thx Andrey Mirtchovski err was `write udp 127.0.0.1:59864->127.0.0.1:5127: use of WriteTo with pre-connected connection` -- 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

[go-nuts] net: conn.WriteToUDP([]byte("not ok"), addr)

2019-10-09 Thread Gert
Hi, I am trying to figure out why what's going on? conn.Write([]byte("ok")) https://play.golang.org/p/8Fq1XyYTFs1 vs conn.WriteToUDP([]byte("not ok"), addr) https://play.golang.org/p/NkUKn-Oz8XA I assumed it was unintended behavior and opened a issue at

[go-nuts] asm: FUNCDATA PCDATA

2019-08-20 Thread Gert
https://golang.org/doc/asm $ cat x.go package main func main() { println(3) } $ GOOS=linux GOARCH=amd64 go tool compile -S x.go# or: go build -gcflags -S x.go --- prog list "main" --- (x.go:3) TEXTmain+0(SB),$8-0 0001 (x.go:3) FUNCDATA $0,gcargs·0+0(SB) 0002 (x.go:3)

[go-nuts] Re: Go compiler backlog

2019-07-07 Thread Gert
Ok thx On Monday, July 8, 2019 at 6:29:34 AM UTC+2, Liam wrote: > > Get, you may get more response on this by posting to golang-dev... > > On Sunday, July 7, 2019 at 3:06:55 PM UTC-7, Gert wrote: >> >> My intelligence is that of a ping pong ball but think it's time to cle

[go-nuts] Re: Citation Needed

2019-07-07 Thread Gert
On Saturday, July 6, 2019 at 8:51:19 AM UTC+2, go je wrote: > > Is the Category "Games" gaining attention in the go community? > Are the Developers writing for production level? > Do we have an examples? > There is no game engine in the standard library but you will find Go game engines on

[go-nuts] Go compiler backlog

2019-07-07 Thread Gert
My intelligence is that of a ping pong ball but think it's time to clean up de go compiler backlog so ping pong balls like me have a chance to understand the compiler code. For example from the compiler readme ``` Note that the `go/*` family of packages, such as `go/parser` and `go/types`, have

[go-nuts] gc: have Unwrap() wrapper, want Unwrap()

2019-07-04 Thread Gert
Does somebody have some time please to explain what I am forgetting to change in the go compiler. Why my added wrapper type is reconiest as instead of wrapper, thanks :) When you do ./all.bash you get errorString does not implement error (wrong type for Unwrap method) have

Re: [go-nuts] can't change build in type error interface

2019-07-03 Thread Gert
On Thursday, July 4, 2019 at 3:28:01 AM UTC+2, Ian Lance Taylor wrote: > > On Wed, Jul 3, 2019 at 6:19 PM Gert > > wrote: > > > > On Thursday, July 4, 2019 at 2:52:42 AM UTC+2, Ian Lance Taylor wrote: > >> > >> On Wed, Jul 3, 2019 at 4:39 PM Gert

Re: [go-nuts] can't change build in type error interface

2019-07-03 Thread Gert
On Thursday, July 4, 2019 at 2:52:42 AM UTC+2, Ian Lance Taylor wrote: > > On Wed, Jul 3, 2019 at 4:39 PM Gert > > wrote: > > > > On Thursday, July 4, 2019 at 12:39:34 AM UTC+2, Ian Lance Taylor wrote: > >> > >> On Wed, Jul 3, 2019 at 3:30 PM G

[go-nuts] can't change build in type error interface

2019-07-03 Thread Gert
I changed /usr/local/go/src/builtin/builtin.go type error interface { Error() string Unwrap() wrapper.Wrapper } But after compiling go successfully with ./all.bash it seems type error is stil type error interface { Error() string } -- You received this message because you are

Re: [go-nuts] Re: errors/wrap.go looks like it could be made into a more general monad package?

2019-07-02 Thread Gert
threading of values between computations. A result of one > computation gets threaded as an input to the next one, and so on. > > Second, what would be the use-case of this other than errors? > > On Wed, Jul 3, 2019, 04:52 Gert > wrote: > >> On Wednesday, July 3, 2019

[go-nuts] Re: errors/wrap.go looks like it could be made into a more general monad package?

2019-07-02 Thread Gert
On Wednesday, July 3, 2019 at 3:03:20 AM UTC+2, Gert wrote: > > https://github.com/golang/go/blob/master/src/errors/wrap.go > > What if we replaced all error types in that file with a empty interface or > a general monad interface? Can we make it work for other types too and &g

[go-nuts] Re: errors/wrap.go looks like it could be made into a more general monad package?

2019-07-02 Thread Gert
On Wednesday, July 3, 2019 at 3:03:20 AM UTC+2, Gert wrote: > > https://github.com/golang/go/blob/master/src/errors/wrap.go > > What if we replaced all error types in that file with a empty interface or > a general monad interface? Can we make it work for other types too and &g

[go-nuts] Re: errors/wrap.go looks like it could be made into a more general monad package?

2019-07-02 Thread Gert
On Wednesday, July 3, 2019 at 3:03:20 AM UTC+2, Gert wrote: > > https://github.com/golang/go/blob/master/src/errors/wrap.go > > What if we replaced all error types in that file with a empty interface or > a general monad interface? Can we make it work for other types too and &g

[go-nuts] errors/wrap.go looks like it could be made into a more general monad package?

2019-07-02 Thread Gert
https://github.com/golang/go/blob/master/src/errors/wrap.go What if we replaced all error types in that file with a empty interface or a general monad interface? Can we make it work for other types too and introduce a new monad package instead a new error package only? -- You received this

Re: [go-nuts] go build src code of `go doc`

2019-06-26 Thread Gert
On Thursday, June 27, 2019 at 1:44:20 AM UTC+2, Gert wrote: > > On Thursday, June 27, 2019 at 12:11:58 AM UTC+2, Ian Lance Taylor wrote: >> >> On Wed, Jun 26, 2019 at 1:39 PM Gert wrote: >> > >> > Hmm trying to work on the src code of `go doc` but every time

Re: [go-nuts] go build src code of `go doc`

2019-06-26 Thread Gert
On Thursday, June 27, 2019 at 12:11:58 AM UTC+2, Ian Lance Taylor wrote: > > On Wed, Jun 26, 2019 at 1:39 PM Gert > > wrote: > > > > Hmm trying to work on the src code of `go doc` but every time I try to > compile a ./doc binary it uses other src code, it doe

[go-nuts] go build src code of `go doc`

2019-06-26 Thread Gert
Hmm trying to work on the src code of `go doc` but every time I try to compile a ./doc binary it uses other src code, it doesn't look in the current directory am in, I have to force it `go build main.go` what going on here? gert@gert ~/Desktop/go/src/cmd/doc:master> go build gert@g

Re: [go-nuts] interface{private()}

2019-06-20 Thread Gert
Thanks, does the go standard library have a use case where a private() function in a interface is needed? Looking for more examples to understand the benefit to do so. On Friday, June 21, 2019 at 2:36:01 AM UTC+2, Ian Lance Taylor wrote: > > On Thu, Jun 20, 2019 at 5:25 PM Gert >

[go-nuts] interface{private()}

2019-06-20 Thread Gert
Trying to get my mind around why the private() function is necessary here. I fail to understand the comment provided type Geometry interface { GeoJSONType() string Dimensions() int // e.g. 0d, 1d, 2d Bound() Bound // requiring because sub package type switch over all possible types.

Re: [go-nuts] https://godoc.org/github.com/couchbase/moss

2019-06-12 Thread Gert
ols/cmd/godoc > > On Wed, Jun 12, 2019 at 3:25 PM Gert > > wrote: > > > > Is it just me or is stuff missing in godoc like for example > > > > // NewBatch returns a new Batch instance with hinted amount of > > // resources expected to be required. > &

Re: [go-nuts] https://godoc.org/github.com/couchbase/moss

2019-06-12 Thread Gert
aaa ok thx On Wednesday, June 12, 2019 at 11:40:29 PM UTC+2, David Anderson wrote: > > collection is an unexported type. Godoc doesn't show unexported types by > default, so none of the methods of collection will appear. > > On Wed, Jun 12, 2019 at 2:25 PM Gert > > wrot

[go-nuts] https://godoc.org/github.com/couchbase/moss

2019-06-12 Thread Gert
Is it just me or is stuff missing in godoc like for example // NewBatch returns a new Batch instance with hinted amount of // resources expected to be required. func (m *collection) NewBatch(totalOps, totalKeyValBytes int) ( ... } from collection.go https://godoc.org/github.com/couchbase/moss

Re: [go-nuts] [Go2] move everything to gopath so goroot isn't required anymore

2018-12-02 Thread Gert
https://github.com/golang/go/issues/29070 On Monday, December 3, 2018 at 5:01:59 AM UTC+1, Gert wrote: > > Ok thx I will also look on the github repo if I can find it, if not I > create a new one > > On Monday, December 3, 2018 at 4:22:48 AM UTC+1, Sam Whited wrote: >> &

Re: [go-nuts] [Go2] move everything to gopath so goroot isn't required anymore

2018-12-02 Thread Gert
ng system) which could be > versioned separately from Go so that fixes could be released without having > to wait on the full Go release cycle. I can't find a link at the moment, > but the Go team has mentioned the possibility of doing this. > > —Sam > > On Sun, Dec 2, 2018, at

[go-nuts] [Go2] move everything to gopath so goroot isn't required anymore

2018-12-02 Thread Gert
Can we move stdlib (goroot) to gopath in Go2? On install you can do go get -u stdlib to download the stdlib into gopath. Basically getting rid of goroot. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: `go test -c` skips init from main while `go test` doesn't

2018-08-15 Thread Gert
inimal reproducible example? On Monday, August 13, 2018 at 8:21:30 PM UTC-4, Gert wrote: Hi, `go test` runs the main init but the binary created by go test -c -a -tags 'netgo noplugin' -gcflags "all=-N -l" doesn't. Is this a bug? Also it's seems you can't compile static test binar

[go-nuts] `go test -c` skips init from main while `go test` doesn't

2018-08-13 Thread Gert
Hi, `go test` runs the main init but the binary created by go test -c -a -tags 'netgo noplugin' -gcflags "all=-N -l" doesn't. Is this a bug? Also it's seems you can't compile static test binaries only non test binaries can be compiled static? -- You received this message because you are

[go-nuts] [Go2] cleanup deprecated code

2017-09-25 Thread Gert
Make sure you can track all deprecated code for Go2 for removal example https://golang.org/src/encoding/csv/reader.go#L109 `TrailingComma bool // ignored; here for backwards compatibility` Life is to short to wait another 10 years to fix things Thx --

[go-nuts] Re: defer func() { _ = resp.Body.Close() }()

2017-08-16 Thread Gert
Never mind the tool is right I could print the error or something like that, I assumed you couldn't do anything useful with the error anyway in a defer On Wednesday, August 16, 2017 at 2:05:39 PM UTC+2, Gert wrote: > > To pass errcheck I need to do something like > >

[go-nuts] defer func() { _ = resp.Body.Close() }()

2017-08-16 Thread Gert
To pass errcheck I need to do something like defer func() { _ = resp.Body.Close() }() instead of defer resp.Body.Close() Is this something the errcheck tool can figure out to mark as valid instead or does the errcheck tool need help from the compiler so the second case is also ok? -- You

Re: [go-nuts] [Go2] append

2017-08-07 Thread Gert
On Monday, August 7, 2017 at 9:39:06 PM UTC+2, Jan Mercl wrote: > > > Does this code really output what you want it to output? > https://play.golang.org/p/DWQXtkGByv > > Assigning the result value of append to a different variable than its > first argument is completely valid, but one has to be

Re: [go-nuts] Re: [Go2] Reflect

2017-08-07 Thread Gert
On Monday, August 7, 2017 at 5:59:15 PM UTC+2, rog wrote: > > What is this supposed to do? What does it do if the value > isn't an integer? Same error as you do int("4") > Are you thinking that it would be the same as fmt.Println("value:", > r.Interface().(int)) ? > Nope more that it

[go-nuts] [Go2] append

2017-08-07 Thread Gert
Can append or the compiler be made to prevent or warn for bugs like this? package main import ( "fmt" ) func main() { a := []byte("Help") b := append(a, []byte(" Me ")...) c := append(a, []byte(" Her")...) fmt.Println(string(a), "-", string(b), "-", string(c)) } -- You received this message

Re: [go-nuts] Re: [Go2] Reflect

2017-08-07 Thread Gert Cuykens
On Mon, Aug 7, 2017 at 12:03 PM, roger peppe wrote: > ISTM that the only thing you're suggesting is to change > the spelling of "reflect.ValueOf" to "reflect". > > I don't understand what semantics you'd expect > > fmt.Println("value:", r.Value(int)) > > to have.

Re: [go-nuts] Re: [Go2] Reflect

2017-08-06 Thread Gert
On Monday, August 7, 2017 at 12:41:18 AM UTC+2, kortschak wrote: > > The reflect package is not mentioned in the spec (except once to > discuss struct tags), adding a built-in would require its definition > there, and complicate the language. Making it easier to use would also > have the

[go-nuts] Re: [Go2] Reflect

2017-08-06 Thread Gert
oesn't Reflect already do this? > https://play.golang.org/p/CIm7aISztv > > > On Saturday, August 5, 2017 at 12:58:52 PM UTC-4, Gert wrote: >> >> package main >> >> import ( >> "fmt" >> "reflect" >> ) >> >>

[go-nuts] [Go2] Reflect

2017-08-05 Thread Gert
package main import ( "fmt" "reflect" ) func main() { x := 4 v1 := reflect.ValueOf(x) fmt.Println("type:", v1.Type()) v2 := reflect.TypeOf(x) fmt.Println("type:", v2) } Kan we have something like this instead please package main import ( "fmt" "reflect" ) func main() { x := 4 r := reflect(x)

Re: [go-nuts] [Go2] Proposal remove function return type brackets

2017-07-24 Thread Gert Cuykens
string) []byte, error { >blah > } > > Rémy. > > 2017-07-23 18:18 GMT+02:00 Gert <gert.cuyk...@gmail.com>: >> I personally don't think () is necessary for output types and is only >> confusing with the function attributes >> >> Example >> >>

[go-nuts] [Go2] Proposal remove function return type brackets

2017-07-23 Thread Gert
I personally don't think () is necessary for output types and is only confusing with the function attributes Example func Hello(b string) ([]byte, error) { } func Hello(b string) []byte, error { } func Hello(b string) a []byte, b error { } Feel free to counter argument

[go-nuts] Re: [Go2] toward-go2

2017-07-17 Thread Gert
se it would be the Go1 compatibility promise, but should be kept track > of. > > Apple didn't mention Swift because Apple doesn't mention things it is > working on. Working in private and then releasing when things are ready is > how Apple does things. > > On Monday, July 17, 2017

[go-nuts] [Go2] toward-go2

2017-07-16 Thread Gert
There are so many https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+go2+label%3AGo2 proposals already I can barely figure out if feature x y or z is already asked. Can we have a Go2 branch / milestone please? PS now that you announced toward-go2 you are going to actively work on Go2