[go-nuts] Re: Go-path from a source other than $GOPATH (and package management)

2018-04-20 Thread Florin Pățan
> Anyway, as I have mentioned before, this solves nothing when multiple > versions of a nested dependency is needed by project dependencies. This is a problem that's solved by vgo. Have a look into that. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Accessing Slices Made From Same Array Concurrently

2018-04-20 Thread Ian Lance Taylor
On Fri, Apr 20, 2018 at 8:26 PM, Kaveh Shahbazian wrote: > > Is it safe to access slices that shares a back array concurrently? (Assuming > the length of slices will not change) It's safe to read from them concurrently. It's not in general safe to modify them

[go-nuts] Re: Accessing Slices Made From Same Array Concurrently

2018-04-20 Thread Louki Sumirniy
I am pretty sure that you will run into problems with this. On one hand passing pointers could lead to a write after a read, and on the other hand with pass by value you could get an out of date value and then stomp over another process write. I'm pretty sure the race detector will flag this.

[go-nuts] Accessing Slices Made From Same Array Concurrently

2018-04-20 Thread Kaveh Shahbazian
Is it safe to access slices that shares a back array concurrently? (Assuming the length of slices will not change) -- 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

Re: [go-nuts] net/http: get does not work

2018-04-20 Thread John Shahid
Is any of the following set `HTTPS_PROXY', `HTTP_PROXY' ? The DefaultTransport pays attention to those env vars to decide whether to use a proxy or not. If that's not the case, what is the error that you're getting ? cheers, -js yyq2...@gmail.com writes: > http.Get doesn't work with default

[go-nuts] Re: net/http: get does not work

2018-04-20 Thread hryan
url := "https://google.com/; req, err := http.NewRequest("GET", url, nil) if err != nil { log.Fatal(err) fmt.Printf(err.Error()) return } res, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) fmt.Printf(err.Error())

[go-nuts] Re: Go-path from a source other than $GOPATH (and package management)

2018-04-20 Thread Kaveh Shahbazian
Indeed it is possible to set the $GOPATH in a shell. And if I use other tools with a specific project, for example VSCode, then I have to start all of them from the same terminal. Which is not the most desirable outcome. Anyway, as I have mentioned before, this solves nothing when multiple

[go-nuts] "github.com/google/gopacket" package alternative

2018-04-20 Thread Binu Paul
Hi any alternative library available for "github.com/google/gopacket" which generate live traffic Regards, Binu -- 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

[go-nuts] Re: parallel array processing question

2018-04-20 Thread Ankit Gupta
There could have been a data race in your code with the usage of allMax variable which is updated and checked by multiple goroutines. But you are saved by the use of mutex. All shared variables, in general, are subject to data races when there is a write involved. The local variables you create

[go-nuts] net/http: get does not work

2018-04-20 Thread yyq2008
http.Get doesn't work with default transport, but works fine if I set a custom as following(uncomment the two lines) package main import ( "net/http" "io/ioutil" "fmt" "log" ) func main() { //tr := {} //http.DefaultClient.Transport =tr

[go-nuts] Re: Go-path from a source other than $GOPATH (and package management)

2018-04-20 Thread Manlio Perillo
Il giorno giovedì 19 aprile 2018 14:48:09 UTC+2, Kaveh Shahbazian ha scritto: > > Is it possible to tell go tools to get the go-path from a source other > than $GOPATH? > > No, but you can of course set the GOPATH environment variable for the go tool. As an example, on an UNIX shell: $

Re: [go-nuts] Sending and receiving on file descr other than stdin/out/err

2018-04-20 Thread Robert Bielik
Den fredag 20 april 2018 kl. 16:11:36 UTC+2 skrev Ian Lance Taylor: > > On Fri, Apr 20, 2018 at 7:09 AM, Robert Bielik > wrote: > >> > >> Look at how os.Stdin and friends are initialized in os/file.go. > >> https://golang.org/src/os/file.go#L51 . > > > > > > Hmm...

Re: [go-nuts] Sending and receiving on file descr other than stdin/out/err

2018-04-20 Thread Ian Lance Taylor
On Fri, Apr 20, 2018 at 7:09 AM, Robert Bielik wrote: >> >> Look at how os.Stdin and friends are initialized in os/file.go. >> https://golang.org/src/os/file.go#L51 . > > > Hmm... the syscall vars are platform specific. Is there a way to do this > cross-platform ? > >

Re: [go-nuts] Sending and receiving on file descr other than stdin/out/err

2018-04-20 Thread Robert Bielik
> > > Look at how os.Stdin and friends are initialized in os/file.go. > https://golang.org/src/os/file.go#L51 . > Hmm... the syscall vars are platform specific. Is there a way to do this cross-platform ? Btw. the syntax worked on linux, but not Windows. -- You received this message because

Re: [go-nuts] Sending and receiving on file descr other than stdin/out/err

2018-04-20 Thread Robert Bielik
Ok, with the below syntax I managed to write to fd 4, and on the bash cmd line do 4>&2 to redirect to stdout. /R Den fredag 20 april 2018 kl. 15:03:41 UTC+2 skrev Robert Bielik: > > Exactly how would the call on the child side look ? > > file := os.NewFile(uintptr(3), "fd3") > > ? > > Den

Re: [go-nuts] Sending and receiving on file descr other than stdin/out/err

2018-04-20 Thread Ian Lance Taylor
On Fri, Apr 20, 2018 at 6:03 AM, Robert Bielik wrote: > > Exactly how would the call on the child side look ? > > file := os.NewFile(uintptr(3), "fd3") > > ? Yes (except that if you use a literal 3 note that Go constants are untyped so you don't need to use an explicit

Re: [go-nuts] Sending and receiving on file descr other than stdin/out/err

2018-04-20 Thread Robert Bielik
Exactly how would the call on the child side look ? file := os.NewFile(uintptr(3), "fd3") ? Den fredag 20 april 2018 kl. 14:54:29 UTC+2 skrev Ian Lance Taylor: > > On Fri, Apr 20, 2018 at 5:22 AM, Robert Bielik > wrote: > > > > I have an application where I'd like to

Re: [go-nuts] html/template: urlEscaper uses small letters to escape, whereas URLQueryEscaper uses capitals

2018-04-20 Thread Ian Lance Taylor
On Thu, Apr 19, 2018 at 9:35 PM, wrote: > > i noticed that html/template escapes a URI using small letters. For example, > the following code outputs "%e5%af%bf%e5%8f%b8", not "%E5%AF%BF%E5%8F%B8". > > t, _ := template.New("foo").Parse(`{{define "T"}}

Re: [go-nuts] Sending and receiving on file descr other than stdin/out/err

2018-04-20 Thread Ian Lance Taylor
On Fri, Apr 20, 2018 at 5:22 AM, Robert Bielik wrote: > > I have an application where I'd like to be able to pipe data in/out, but not > on stdin/stdout/err, but on other file descriptors. How to ? If you are on a Unix system, on the parent side see the ExtraFiles field

Re: [go-nuts] Go-path from a source other than $GOPATH (and package management)

2018-04-20 Thread Paul Jolly
Or, just for completeness, https://github.com/cxreg/smartcd On 20 April 2018 at 13:45, unknown wrote: > > You can use direnv[1] to achieve what you want > > [1]: https://direnv.net/ > > -- > You received this message because you are subscribed to the Google Groups >

Re: [go-nuts] Go-path from a source other than $GOPATH (and package management)

2018-04-20 Thread unknown
You can use direnv[1] to achieve what you want [1]: https://direnv.net/ -- 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] html/template: urlEscaper uses small letters to escape, whereas URLQueryEscaper uses capitals

2018-04-20 Thread nekketsuuu
i noticed that html/template escapes a URI using small letters. For example, the following code outputs "%e5%af%bf%e5%8f%b8", not " %E5%AF%BF%E5%8F%B8". t, _ := template.New("foo").Parse(`{{define "T"}}{{end}}`) t.ExecuteTemplate(os.Stdout, "T", "寿司") (See https://play.golang.org/p/9caza-3ojur )

Re: [go-nuts] using ginkgo

2018-04-20 Thread unknown
Keith Brown writes: > I would like to have a tool for testing infrastructure components. I > stumbled across Ginkgo. Does anyone use it? Yes, it is being used by multiple CloudFoundry projects [1] > Does it need a go compiler for tests? Yes. > My intention is to write

[go-nuts] Sending and receiving on file descr other than stdin/out/err

2018-04-20 Thread Robert Bielik
I have an application where I'd like to be able to pipe data in/out, but not on stdin/stdout/err, but on other file descriptors. How to ? Regards /R -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] New blog post "Hello, Tello - Hacking Drones With Go"

2018-04-20 Thread Ron Evans
Hello, all Just published a new blog post about hacking the DJI Tello drone using Go. Please check it out: https://gobot.io/blog/2018/04/20/hello-tello-hacking-drones-with-go/ Thank you! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: Fancy Comments & Documentation

2018-04-20 Thread Louki Sumirniy
I personally think that in the specific case of OOP code syntactic sugar declarative structuring stuff - and maybe also godoc header comments such as within type struct and type interfaces would make Go code even more readable. There is limits to how far readability and consequential

[go-nuts] Re: parallel array processing question

2018-04-20 Thread Stefan Nilsson
Reading only is safe, but you will have a data race if two goroutines access the same variable concurrently and at least one of the accesses is a write. Here is an article that gives some rules of thumb on how to efficiently schedule parallel computation on separate CPUs:

[go-nuts] Re: Fancy Comments & Documentation

2018-04-20 Thread Chris FractalBach
Thanks everyone for posting. I poked my head around the standard library in search of comments, and the only file I found so far that uses --- lines: https://golang.org/src/go/ast/ast.go ... which is used to separate sections. //