[go-nuts] [ANN] Gop - Build and manage your Go applications out of GOPATH

2017-08-16 Thread Lunny Xiao
GOP is a project manangement tool for building your golang applications out of GOPATH. Also this means it's not go-getable. GOP copy all denpendencies to src/vendor directory and all application's source is also in this directory. A normal process using gop is below: git clone

Re: [go-nuts] Go 2 suggestion - what dependencies included in a build?

2017-08-16 Thread Jakob Borg
Keep in mind that you can't assume vcs info is available at build time. They may be building from a downloaded tarball, in which case you *may* have a Gopkg.lock (if everyone uses dep) but not much else. They may be Debian and build from source packages where the Go compiler sees no version

[go-nuts] Re: Go 2 suggestion - what dependencies included in a build?

2017-08-16 Thread Lucio
On Wednesday, 16 August 2017 01:58:00 UTC+2, Eric Johnson wrote: > > [ ... ] > I'm happy to contributing to further exploring implementation, but I > figured I'd start by asking a question, in case someone is already working > in this direction. > > I was thinking that it ought to be possible

[go-nuts] Re: append() gotcha!

2017-08-16 Thread Lucio
On Wednesday, 16 August 2017 05:16:45 UTC+2, Nate Finch wrote: > > This is an unfortunate side effect of using ... (a variadic) in append. > Zero is a valid number of arguments to pass to it. > >> >> >> But append is not a normal function, it is an intrinsic, so the compiler could implement a

Re: [go-nuts] How can I write/read a file by taking the advantage of linux writev/readv in golang?

2017-08-16 Thread Ian Lance Taylor
On Wed, Aug 16, 2017 at 7:01 PM, yihao yang wrote: > > I want to take advantage of writev when writing a file. But I didn't find > the interface that accepts a [][]byte parameter. > What can I do? At present we only support writev to network sockets. You can use it by

[go-nuts] Re: memmove receives NULL src and positive length?

2017-08-16 Thread 'Björn Karge' via golang-nuts
Just a minor correction: go tool objdump showed that *golang does not touch the pointer value before overwriting it*. The situation does occur nevertheless because obj.data may be nil [0x0,0,0] initially, and length/capacity are assigned before the data pointer is set: obj.data : [0x0,0,0]

[go-nuts] How can I write/read a file by taking the advantage of linux writev/readv in golang?

2017-08-16 Thread yihao yang
Hi, I want to take advantage of writev when writing a file. But I didn't find the interface that accepts a [][]byte parameter. What can I do? Thanks, Yihao -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] Re: append() gotcha!

2017-08-16 Thread xingtao zhao
Sometimes, I use: a := []int{ 1, 2, 3 } b : = append([]int(nil), a...) to copy a slice. On Wednesday, August 16, 2017 at 12:31:13 PM UTC-7, Nate Finch wrote: > > Wrote it up as an issue: https://github.com/golang/go/issues/21482 > > and I agree that using append to assign to a different variable

[go-nuts] database/sql - prepared select statements only work on first invocation

2017-08-16 Thread Ain
Hi I tried to use prepared statements and it works first time, but fails on second query. Ie code like tx, err := db.Begin() if err != nil { log.Fatalf("Error starting tx: %v", err) } defer tx.Rollback() st, err := tx.Prepare("select foo from t where id=?") if

[go-nuts] Re: append() gotcha!

2017-08-16 Thread Nate Finch
Wrote it up as an issue: https://github.com/golang/go/issues/21482 and I agree that using append to assign to a different variable than the one in the append call is almost always going cause surprising behavior but it's less clearly a mistake than append with only a single argument. On

Re: [go-nuts] License for x/image/testdata and x/image/font/testdata files

2017-08-16 Thread Ian Lance Taylor
My guess is that all those files are covered by the LICENSE file at the top level, but CC'ing Nigel to double check. Ian On Wed, Aug 16, 2017 at 11:50 AM, wrote: > Hello, > > I was wondering if I should assume BSD 3 clause licenses for all the files > located under > >

[go-nuts] License for x/image/testdata and x/image/font/testdata files

2017-08-16 Thread athoscribeiro
Hello, I was wondering if I should assume BSD 3 clause licenses for all the files located under x/image/testdata and x/image/font/testdata since there are no licese notes regarding those files (fonts and images). Thanks for the input and I am sorry if this is not the right place for this

Re: [go-nuts] Go 2 suggestion - what dependencies included in a build?

2017-08-16 Thread 'Eric Johnson' via golang-nuts
I note it as something for Go 2, if only because it would be good to standardize it across all Go binaries, so it was possible to introspect *every* Go executable. Otherwise, I have to push to get all teams using go to adopt the same approach to building in this information, rather than having

[go-nuts] Re: studying golang code

2017-08-16 Thread Hugo Torres
One of the things I love about Go is that the standard library is very readable, even for beginners (relative to the standard libraries of other languages). I think the database/sql package is great. The way it uses interfaces to handle testing is a good example of good quality code IMO. On

Re: [go-nuts] Go 2 suggestion - what dependencies included in a build?

2017-08-16 Thread Lars Seipel
On Tue, Aug 15, 2017 at 04:58:00PM -0700, 'Eric Johnson' via golang-nuts wrote: > As I scan reports of vulnerable software, I'm concerned that it is > impossible to tell, from a Go binary, what was used to build that binary. A lot of projects are already doing this, if somewhat indirectly: they

[go-nuts] Re: gomobile socket permissions

2017-08-16 Thread Elias Naur
Hi, Have you tried the golang.org/x/mobile/example/network example? It's a "pure" Go app that doesn't use Java bindings, but its network access properties should be the same. If that works, you could modify golang.org/x/mobile/example/bind to introduce a simple http.Get (or net.Dial) and see

[go-nuts] Re: Full Time Job Opportunity at Mattel: Remote inside US OK

2017-08-16 Thread Nate Finch
Just in case it's not clear, since I've gotten a few responses from contractors: We're looking for full time employees only. Not contractors. You must live and be authorized to work in the United States. Thanks! -Nate -- You received this message because you are subscribed to the Google

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

2017-08-16 Thread Jakob Borg
As far as I'm concerned, `defer resp.Body.Close()` is perfectly cromulent and there's no need to for error checking contortions to satisfy the lint tool. If we're talking about a http.Request I doubt that the close can ever fail (I haven't checked; but it doesn't seem like something that would

[go-nuts] Re: Go ordered map

2017-08-16 Thread Tong Sun
Oh, thanks a lot Egon, Your neat and elegant code is very helpful for me to get the idea and get started. Just FTA, in case someone is also reading this, more onto *sorting the slice*, here is my archive from this list: https://groups.google.com/d/msg/golang-nuts/WV4d-0UTvLo/tJOoqOf9AgAJ I

[go-nuts] Re: append() gotcha!

2017-08-16 Thread Val
Agreed, append with only one argument doesn't look good and should be vetted. As a superset of this problem, any use of *a* = append(*b*, *c*) with *b* != *a* (i.e. not assigning back to the same slice variable) looks either broken or cryptic me. This holds whether *c* is zero or one or more

[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 > > defer func() { _ =

[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

[go-nuts] Re: Go ordered map

2017-08-16 Thread Egon
Do you mean ordered map or sorted map... either way, as long as the N is small, then you can use a slice to provide the extra functionality: 1. sorted map https://play.golang.org/p/oLM4u5HwQ6 2. ordered map https://play.golang.org/p/OFXhFyyrmZ On Wednesday, 16 August 2017 03:17:29 UTC+3, Tong

Re: [go-nuts] Go 2 suggestion - what dependencies included in a build?

2017-08-16 Thread Jan Mercl
On Wed, Aug 16, 2017 at 1:58 AM 'Eric Johnson' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I'm happy to contributing to further exploring implementation, but I figured I'd start by asking a question, in case someone is already working in this direction. That'd be a nice tool for

Re: [go-nuts] XML newline escaping

2017-08-16 Thread patrickjtraynor
That makes sense, and in fact my XML output with s gets parsed later correctly. My personal use case has input XML files with literal LF characters, and it's frustrating that when my Go program modifies that file, they're all converted, which makes my git commit including that XML file messy.

Re: [go-nuts] studying golang code

2017-08-16 Thread Konstantin Khomoutov
On Tue, Aug 15, 2017 at 02:42:45PM -0700, Keith Brown wrote: [...] > Now, as I learn golang, are there any worth while projects I can use as > reference for writing high quality go code? I am not necessary looking for > code standards but more of code setup and quality so I can practice those