[go-nuts] Code completion w/o GOPATH

2018-08-09 Thread 'meta keule' via golang-nuts
Hi, I wonder how in a world of go modules without a GOPATH, code completion within editors is supposed to be implemented? Best, Benny -- 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] How to signal(sigint) blocking goroutine

2018-08-09 Thread Ian Lance Taylor
On Thu, Aug 9, 2018 at 6:51 PM, wrote: > > https://play.golang.org/p/mr58JS4WsJV > > Okay, I realize now that I didn't do a very good job in my first post of > explaining my problem, so I'll trying again. In the above code I need to > signal(sigint or sigterm) the exec.CommandContext on line 69

[go-nuts] Re: go/format ouputs spurious newlines

2018-08-09 Thread naha
I've done some further exploring. The expression computed by the line https://github.com/MarkNahabedian/Goshua/blob/ee72218487f39d2e97ade086df23dbcfcb4c2db3/rete/rule_compiler/rule_compiler.go#L214 has both a valid Pos() and a valid End(). parseExpression is defined at

[go-nuts] Re: Go 1.11 Beta 3 is released

2018-08-09 Thread 'Bryan Mills' via golang-nuts
Did you happen to install it using another go1.11 beta build in module mode? If so, it could have been https://golang.org/issue/26869. On Thursday, August 9, 2018 at 4:35:31 PM UTC-4, Ken MacDonald wrote: > > Hi, > Just attempted to install 1.11beta3. Using the following instructions, the >

Re: [go-nuts] How to signal(sigint) blocking goroutine

2018-08-09 Thread nateandjenn
https://play.golang.org/p/mr58JS4WsJV Okay, I realize now that I didn't do a very good job in my first post of explaining my problem, so I'll trying again. In the above code I need to signal(sigint or sigterm) the exec.CommandContext on line 69 that is blocking so it will stop and finish the

[go-nuts] Re: My trouble about GO interface

2018-08-09 Thread Tim Peoples
I think the confusion comes from how you're exposing each interface -- or rather, how you seem to imply their use. In your example, you provide packages pet and filepath each of which define a Walk interface *plus* one or more structs that implement that interface. But, neither package

Re: [go-nuts] Is this a go fmt bug? map[string]int{...}

2018-08-09 Thread Ian Lance Taylor
On Thu, Aug 9, 2018 at 2:03 PM, wrote: > Hi Sam, I'm running 1.10.3 on High Sierra, installed via brew. > > Here's some more helpful output: > > ➜ awesomeProject go version > go version go1.10.3 darwin/amd64 > ➜ awesomeProject gofmt test.go > > package main > > var m_19_chars = map[string]int{

Re: [go-nuts] Re: Go 1.11 Beta 3 is released

2018-08-09 Thread Peter Waller
Hi Ken, If "go get" succeeded, then probably this put something in $GOPATH/bin/go1.11beta3, but bash being unable to find it means that $GOPATH/bin is not in your $PATH environment variable; so bash can't find it. Try "$GOPATH/bin/go1.11beta3 download" or try adding $GOPATH/bin to your $PATH,

Re: [go-nuts] Is this a go fmt bug? map[string]int{...}

2018-08-09 Thread russoj88
Hi Sam, I'm running 1.10.3 on High Sierra, installed via brew. Here's some more helpful output: ➜ awesomeProject go version go version go1.10.3 darwin/amd64 ➜ awesomeProject gofmt test.go package main var m_19_chars = map[string]int{ "i": 0, "iii": 0, "iii": 0, } var

[go-nuts] Re: Go 1.11 Beta 3 is released

2018-08-09 Thread Ken MacDonald
Hi, Just attempted to install 1.11beta3. Using the following instructions, the "go get" portion appears to have succeeded, but "go1.11beta3 download" fails with "bash: go1.11beta3: command not found". This worked fine on my Mac, but trying on a CentOS system now. Suggestions welcome. > If you

Re: [go-nuts] Is this a go fmt bug? map[string]int{...}

2018-08-09 Thread Sam Whited
I can't reproduce this behavior. What version of Go are you running? On Thu, Aug 9, 2018, at 14:27, russo...@gmail.com wrote: > With the following code, running go fmt shows different behavior depending > on the (1) length of the keys, and (2) the order of the keys. > > var m_19_chars =

[go-nuts] Is this a go fmt bug? map[string]int{...}

2018-08-09 Thread russoj88
With the following code, running go fmt shows different behavior depending on the (1) length of the keys, and (2) the order of the keys. var m_19_chars = map[string]int{ "i": 0, "iii": 0, "iii": 0, } var m_18_chars = map[string]int{ "i": 0, "iii":

Re: [go-nuts] How to update packages without duplicating distro packages

2018-08-09 Thread Jakob Borg
On 9 Aug 2018, at 18:13, Kevin Locke wrote: > > That is great! `gobin -u` is very close to what I was looking for. > I think it will be sufficient for my needs. Thank you! > > I'm surprised this isn't part of the go tool, since it seems like all > system administrators would need to use gobin

[go-nuts] Bug? http2 double slash gives "invalid request :path"

2018-08-09 Thread gwillem
A http2 crawler with custom transport chokes on URIs with double slashes. Is it a bug? Testcase: func TestDoubleSlashInUrl(t *testing.T) { url := "https://http2.akamai.com//demo; tr := {} if e := http2.ConfigureTransport(tr); e != nil { t.Fatal("Could not configure h2 transport") } cl :=

[go-nuts] Re: How to calculate x^y? (the power of)

2018-08-09 Thread dhaval . daiict
Modular power in Golang > func power(x,y,p int64) int64 { var res int64 res = 1; // Initialize > result x =(x%p)%mod; // Update x if it is more than or // equal to p for > y>0{ // If y is odd, multiply x with result if y & 1==1{ res = > ((res*x)%p)%mod; } // y must be even now y = y/2; x =

[go-nuts] [ANN] Bitpeek. Make bits human readable.

2018-08-09 Thread Wojciech S. Czarnecki
Bitpacked data pretty-formatter. Zero dependencies. 176 LoC. Every single input bit from 0 to 63 can print a label that show this bit state. Arbitrary group of bits can be printed as decimal, octal or hex numbers and as C32s, Ascii7b or Utf-8 characters. Plus as an IPv4 address in dot-notation.

Re: [go-nuts] How to update packages without duplicating distro packages

2018-08-09 Thread Kevin Locke
On Thu, 2018-08-09 at 06:18 +, Jakob Borg wrote: > On 9 Aug 2018, at 00:09, Kevin Locke wrote: >> Thanks for the explanation! Is there a way for me to update the >> locally installed packages (shfmt and its dependencies in this >> example) without installing additional dependencies which

[go-nuts] Re: How to signal(sigint) blocking goroutine

2018-08-09 Thread gary . willoughby
See this blog post for more interesting ways to handle goroutine communication and synchronization: http://nomad.uk.net/articles/interesting-ways-of-using-go-channels.html On Wednesday, 8 August 2018 04:59:48 UTC+1, natea...@gmail.com wrote: > > https://play.golang.org/p/d5n9bYmya3r > > I'm new

[go-nuts] Re: How to signal(sigint) blocking goroutine

2018-08-09 Thread gary . willoughby
Just re-organise the code a bit, try this: https://play.golang.org/p/GMpfZlCNP9G On Wednesday, 8 August 2018 04:59:48 UTC+1, natea...@gmail.com wrote: > > https://play.golang.org/p/d5n9bYmya3r > > I'm new to the go language and trying to figure out how to sigint a > blocking goroutine. in the

[go-nuts] Re: Keep Vendor folder on library Repository is Bad or Good practice.

2018-08-09 Thread peterGo
Tong Sun "I've never seen [the Author delete the library] happen before." It happened recently. Take a look at jteeuwen/go-bindata: Hard fork of jteeuwen/go-bindata because it disappeared, Peter On Wednesday, August 8, 2018 at 10:01:32 AM UTC-4, Tong Sun wrote: > > I've never seen that

Re: [go-nuts] Re: Struct members, hide or export?

2018-08-09 Thread Jay G
On Thu, Aug 9, 2018 at 8:14 PM Manlio Perillo wrote: > > > > On Thursday, August 9, 2018 at 9:50:55 AM UTC+2, Jay G wrote: >> >> Let's say I'm writing some library for internal usage in my project, what's >> the idiomatic way to design visibility of struct members? >> >> Option 1. export structs

[go-nuts] Re: Struct members, hide or export?

2018-08-09 Thread Manlio Perillo
On Thursday, August 9, 2018 at 9:50:55 AM UTC+2, Jay G wrote: > > Let's say I'm writing some library for internal usage in my project, > what's the idiomatic way to design visibility of struct members? > >- Option 1. export structs and members as much as possible. Only hide >ones that

[go-nuts] Re: Struct members, hide or export?

2018-08-09 Thread snmed
Hi I would suggest to use the second option. If you export all possible members, you have to care on every redesign who and how this members are used. This makes a redesign unnecessarily tricky. Constructor functions are a common pattern in go code and therefore you should not flinch to use

[go-nuts] Struct members, hide or export?

2018-08-09 Thread Jay Guo
Let's say I'm writing some library for internal usage in my project, what's the idiomatic way to design visibility of struct members? - Option 1. export structs and members as much as possible. Only hide ones that need to be protected, e.g. by a lock - Option 2. hide as much as

[go-nuts] Re: My trouble about GO interface

2018-08-09 Thread Volker Dobler
Who would walk his dog on a file path? Seriously. There os no need to technically forbid something nobody will do. Someone who is not willing to read or incapable of understand your documentation of the interface won't be able to use it properly anyway. Go is not done through "Ctrl+Space driven

[go-nuts] My trouble about GO interface

2018-08-09 Thread Henry
As far as I know, there are three ways you can deal with this. First, you can introduce a dummy private method in your interface, so as to differentiate it from other interfaces. The implementing struct will need to implement this dummy method. I don't like this approach for one bit, because it

Re: [go-nuts] How to update packages without duplicating distro packages

2018-08-09 Thread Jakob Borg
On 9 Aug 2018, at 00:09, Kevin Locke mailto:ke...@kevinlocke.name>> wrote: Thanks for the explanation! Is there a way for me to update the locally installed packages (shfmt and its dependencies in this example) without installing additional dependencies which weren't initially installed? You