Re: [go-nuts] go directive in go.mod

2019-03-08 Thread Ian Lance Taylor
On Fri, Mar 8, 2019 at 4:42 PM wrote: > > I am an engineer working on Heroku's Go buildpack. > > Our buildpack needed a way for users to select the version of Go that they > wanted to build their code, so a “hacky” solution of using build tag like > constructs was implemented: > https://github.

[go-nuts] go directive in go.mod

2019-03-08 Thread smudunuri
Hi, I am an engineer working on Heroku's Go buildpack . Our buildpack needed a way for users to select the version of Go that they wanted to build their code, so a “hacky” solution of using build tag like constructs was implemented: https://gith

Re: [go-nuts] Debugging & breakpoints in Go compiler source code

2019-03-08 Thread Ian Lance Taylor
On Fri, Mar 8, 2019 at 4:23 PM Mohit Verma wrote: > > I was looking to see how the golang compiler works, and wanted to step in to > the compilation process to see what happens. I am looking at the standard Go > compiler in src/cmd/compile from https://github.com/golang/go. > > When I try to run

[go-nuts] Debugging & breakpoints in Go compiler source code

2019-03-08 Thread Mohit Verma
Hi All, I was looking to see how the golang compiler works, and wanted to step in to the compilation process to see what happens. I am looking at the standard Go compiler in src/cmd/compile from https://github.com/golang/go. When I try to run the compilation process with gdb, I see I can put brea

Re: [go-nuts] How can race timing inject io.EOF into bufio.NewReader(os.Stdin) ?

2019-03-08 Thread Robert Engels
True, that is probably more likely, but it is EOF because it consumed the data... > On Mar 8, 2019, at 3:17 PM, Kurtis Rader wrote: > >> On Fri, Mar 8, 2019 at 1:01 PM Robert Engels wrote: > >> The other package is closing stdin > > Or consuming the stdin data. Which in my experience is

Re: [go-nuts] How can race timing inject io.EOF into bufio.NewReader(os.Stdin) ?

2019-03-08 Thread Kurtis Rader
On Fri, Mar 8, 2019 at 1:01 PM Robert Engels wrote: > The other package is closing stdin > Or consuming the stdin data. Which in my experience is a slightly more likely explanation. On Mar 8, 2019, at 2:43 PM, Everton Marques > wrote: > > I am debugging an issue that randomly makes the cod

[go-nuts] nested modules in a single repo

2019-03-08 Thread Tamás Gulácsi
Use only one go.mod, at the root level of the project. -- 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. For more options,

Re: [go-nuts] nested modules in a single repo

2019-03-08 Thread Paul Jolly
(full disclosure, I wrote https://github.com/go-modules-by-example/index/blob/master/009_submodules/README.md) Quick first question: are you absolutely sure you need multiple modules? https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories On Fri, 8 Mar 2019 at 20:49, Abhishek

Re: [go-nuts] How can race timing inject io.EOF into bufio.NewReader(os.Stdin) ?

2019-03-08 Thread Robert Engels
The other package is closing stdin > On Mar 8, 2019, at 2:43 PM, Everton Marques wrote: > > I am debugging an issue that randomly makes the code below to hit io.EOF > instead of reporting first byte 'u' from "ugh": > > $ echo "ugh" | eraseme ;# this randomly reports EOF instead of first by

[go-nuts] nested modules in a single repo

2019-03-08 Thread Abhishek Sudhakaran
Trying to make modules work for the below project structure . ├── bll │ ├── billing │ │ ├── details.go │ │ └── go.mod │ ├── complaint │ │ ├── details.go │ │ └── go.mod │ └── task │ ├── details.go │ └── go.mod ├── go.mod └── services ├── billing │ ├── go.

[go-nuts] How can race timing inject io.EOF into bufio.NewReader(os.Stdin) ?

2019-03-08 Thread Everton Marques
I am debugging an issue that randomly makes the code below to hit io.EOF instead of reporting first byte 'u' from "ugh": $ echo "ugh" | eraseme ;# this randomly reports EOF instead of first byte 'u' from "ugh" $ more eraseme/main.go // (snip) func main() { input := bufio.NewReader(os.St

Re: [go-nuts] Re: non-local return?

2019-03-08 Thread Ian Denhardt
Most of what you'd use promises for in Javascript would be better done with channels & goroutines in Go, e.g: resultChan := make(chan SomeType, 1) go func() { // do stuff resultChan <- result } () // do other stuff result := <-resultChan // wait for the result.

Re: [go-nuts] I have an issue in go after make

2019-03-08 Thread Durga Someswararao G
That you have to run from sudo level ( I mean from root level). First do like this For ubuntu : sudo -s For other linux distributions like centos,suse : su Then it will ask for password. Then run your make file/go build. It looks like your make file is trying to use some config files that's why i

Re: [go-nuts] I have an issue in go after make

2019-03-08 Thread Nada Saif
Thank you! On Fri, 8 Mar 2019 at 19:45, Nick wrote: > Great. I don't know much about docker, but it looks like you > probably ran something as sudo that you shouldn't have, again. > > Try running this: > $ sudo chown -R nada:nada /home/nada/.docker > > Hopefully then your docker stuff should be

Re: [go-nuts] Re: Should IP.DefaultMask() exist in today's Internet?

2019-03-08 Thread Tristan Colgate
Just on a point of clarity. DefaultMask is returning the mask associates with the network class. RFC1918 specifies a bunch of class A,B and C networks for private use. E.g. 192.168/16 is a set of 256 class C networks. The correct netmask for one of those class Cs is 255.255.255.0 (/24). So the func

Re: [go-nuts] I have an issue in go after make

2019-03-08 Thread Nick
Great. I don't know much about docker, but it looks like you probably ran something as sudo that you shouldn't have, again. Try running this: $ sudo chown -R nada:nada /home/nada/.docker Hopefully then your docker stuff should be sorted out. Probably worth you reading a bit more about Linux bas

Re: [go-nuts] Re: Should IP.DefaultMask() exist in today's Internet?

2019-03-08 Thread John Dreystadt
Just to be sure we are saying the same things, I am saying that the programmer should be getting the interfaces for the network and walking them looking for the interface with the address they are interested in, and getting the IPMask for that interface. Alas, this is harder than it might be, y

[go-nuts] Re: why slice[len:len] okay, but slice[len] fail?

2019-03-08 Thread jake6502
The other answers to your original question are reasonable, and probably helpful. But I would also like to point out the definitive, though maybe less helpful answer to both your original question, and this new one. You see that behavior because the language specification says you should. Read

[go-nuts] Re: non-local return?

2019-03-08 Thread clementauger888
hi, i might be wrong, it looks likes to me that you want promise in go. something like this https://github.com/chebyrash/promise I personally don t like this pattern, even in javascript. but anyways, example below looks really weird to me and difficult to figure out what means to "reject but

Re: [go-nuts] non-local return?

2019-03-08 Thread Tristan Colgate
I've never seen a coding guide advocate for setjmp/longjump . And having worked a bit in scheme with first class continuations, they have their beauty, but if you want to understand your code a year after you wrote it, I wouldn't personally recommend it. I don't miss either of these things in Go .

Re: [go-nuts] non-local return?

2019-03-08 Thread Robert Engels
I did. No good use for them. People that use them probably also think exceptions for flow control is a good idea. > On Mar 8, 2019, at 8:24 AM, Ian Lance Taylor wrote: > > On Fri, Mar 8, 2019 at 5:02 AM whitehexagon via golang-nuts > wrote: >> >> I'm really liking in Go that I can easily pas

[go-nuts] Is it possible to cache Javascript function references and then Invoke() them ? (WebAssembly)

2019-03-08 Thread Elemer Pixard
Hi, The recommended way to call a Javascript function through syscall/js seems to be: doc := js.Global().Get("document") div := doc.Call("createElement", "div") Why is not possible to cache the Javascript function reference like this: doc := js.Global().Get("document") createElement := doc.G

Re: [go-nuts] I have an issue in go after make

2019-03-08 Thread Nick
Quoth Nada Saif: > The go command works, but when I try to build any golang code, it gives me : > [image: go-err.png] > > I downloaded go1.12 linux/amd64 and extracted it to /usr/local/ > I also added these to .bashrc > export GOPATH = $HOME/go > export PATH=$PATH:$GOPATH/bin > export also PATH=$P

Re: [go-nuts] why slice[len:len] okay, but slice[len] fail?

2019-03-08 Thread howardcshaw
> Could you please explain, why primes[6:6] okay, but primes[7:7] not? Here you go: Given this as a slice: [2:3:5:7:11:13] consider primes[6:6]'s meaning. [2:3:5:7:11:13] [ ] 'return the slice starting after the last element of primes and ending after the last eleme

Re: [go-nuts] I have an issue in go after make

2019-03-08 Thread Nada Saif
The go command works, but when I try to build any golang code, it gives me : [image: go-err.png] I downloaded go1.12 linux/amd64 and extracted it to /usr/local/ I also added these to .bashrc export GOPATH = $HOME/go export PATH=$PATH:$GOPATH/bin export also PATH=$PATH:/usr/local/go/bin Thanks O

Re: [go-nuts] non-local return?

2019-03-08 Thread Ian Lance Taylor
On Fri, Mar 8, 2019 at 5:02 AM whitehexagon via golang-nuts wrote: > > I'm really liking in Go that I can easily pass bits of code around, > 'closures'? Apologies if I have terminology wrong, since I'm new here. > > For a typical asynchronous bit of code I like to pass in a 'func' for what to >

Re: [go-nuts] I have an issue in go after make

2019-03-08 Thread Ian Lance Taylor
On Fri, Mar 8, 2019 at 5:09 AM Nada Saif wrote: > > Hi, I am installing a dev environment on ubuntu vm. > The installation went well but at the end I got a messsage "/bin/sh :go not > found" > > Go is installed, I also added the path to .bashrc file > > go version > go version go1.12 linux/amd64

Re: [go-nuts] Re: non-local return?

2019-03-08 Thread Haddock
As the Dalai Lama likes to say: "No, you must search". Am Freitag, 8. März 2019 14:58:40 UTC+1 schrieb Robert Engels: > > I understand that, but can you point to a real world example that doesn’t > use them in handling some sort of “async” network request? > > On Mar 8, 2019, at 7:43 AM, Haddock

Re: [go-nuts] Re: non-local return?

2019-03-08 Thread Robert Engels
I understand that, but can you point to a real world example that doesn’t use them in handling some sort of “async” network request? > On Mar 8, 2019, at 7:43 AM, Haddock wrote: > > Non-local returns are not about anything with concurrency or threads. It is > about return from a closure where

Re: [go-nuts] Re: non-local return?

2019-03-08 Thread Haddock
Non-local returns are not about anything with concurrency or threads. It is about return from a closure where the thread of execution jumps out of the closure and out of the function that calls it. See this article

[go-nuts] goreadme - automate Github Go projects readme files.

2019-03-08 Thread Eyal
Hi I've created this Github App that automates the creation of readme files. It generates for Go project a readme up on the Go doc. I think it will be useful because it removes the burden of maintaining two documentation resources, and as a side effect, will result in improving the go doc of pr

Re: [go-nuts] Re: non-local return?

2019-03-08 Thread Robert Engels
The reason it is hard to do is that Go correctly decided against this callback type code - it creates callback hell. Concurrency is cheap in Go, it is designed to use CSP or blocking procedural techniques - both far easier to maintain than callback focused systems. > On Mar 8, 2019, at 7:19 AM

[go-nuts] Re: Gorilla Websocket - Proxy with URL, Username and Password

2019-03-08 Thread Subramanian Sridharan
Here's the solution. You generate a proxyUrl and then a dialer like so: proxyURL, _ := url.Parse("http://proxy-ip:proxy-port";) proxyURL.User = url.UserPassword("proxy-username", "proxy-password") dialer := websocket.Dialer{ Proxy: http.ProxyURL(proxyURL), } conn, _, _ := dialer.Dial(WEBSOC

Re: [go-nuts] sync.Pool misuse binary-trees

2019-03-08 Thread Robert Engels
I reviewed the code and it is still pretty inefficient compared to a local free list. I don’t think the single local element helps in the binary tree case anyway, as you are probably releasing branches of the tree at a time. Also, in the face of high cpu based concurrency/contention, the local

[go-nuts] Re: non-local return?

2019-03-08 Thread Haddock
I guess there is no way to get it accomplished. Non-local returns also don't work on the JVM. What the Kotlin guys were doing to work around it was to use inlining, see https://kotlinlang.org/docs/reference/inline-functions.html. In Scala if the Scala compiler sees a non-lucal return, in the ge

[go-nuts] I have an issue in go after make

2019-03-08 Thread Nada Saif
Hi, I am installing a dev environment on ubuntu vm. The installation went well but at the end I got a messsage "/bin/sh :go not found" Go is installed, I also added the path to .bashrc file go version go version go1.12 linux/amd64 which go /usr/local/go/bin/go Can you please suggest ways to re

[go-nuts] non-local return?

2019-03-08 Thread whitehexagon via golang-nuts
I'm really liking in Go that I can easily pass bits of code around, 'closures'? Apologies if I have terminology wrong, since I'm new here. For a typical asynchronous bit of code I like to pass in a 'func' for what to do with the result, and also a 'func' to handle any errors. I'm struggling

Re: [go-nuts] Re: OpenAL and microphone on macos using the mobile pkg

2019-03-08 Thread whitehexagon via golang-nuts
Ah of course, it has to rebuild per target platform. Looking further at the mobile API I'm not sure it includes the Capture part of OpenAL anyway. I'll have a look at kotlin-native for this part of my functionality. Thank you for your help. Peter On Friday, 8 March 2019 10:36:41 UTC+1, Elia

Re: [go-nuts] Re: OpenAL and microphone on macos using the mobile pkg

2019-03-08 Thread Elias Naur
On Thu, Mar 7, 2019 at 11:11 PM whitehexagon via golang-nuts wrote: > > Thanks! That got me some steps further down the rabbit hole :) > > gomobile: the Android requires the golang.org/x/mobile/exp/audio/al, but the > OpenAL libraries was not found. Please run gomobile init with the -openal > fl