[go-nuts] Transferring host's go-mod-download cache into docker container

2019-01-11 Thread Tamás Gulácsi
Use the vendor directory, or use a replace directive with a relative path. -- 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: Suggestions for layout/structure/coding-patterns for GUI applications in Go?

2019-01-11 Thread Lucio
On Saturday, 12 January 2019 01:30:40 UTC+2, Tom wrote: > > Hi! > > *TL;DR: GUI applications seems pretty hard to structure the code in a > readable way. Can anyone recommend any patterns/layout or suggestions to > structuring such a codebase and keeping it readable?* > > [ ... ] > GUI

Re: [go-nuts] Re: What are the reasonable reasons to use pointers?

2019-01-11 Thread andrey mirtchovski
Incidentally, here's Hoare's proposal for records (structs), and pointers (references) for Algol 60: https://archive.computerhistory.org/resources/text/algol/algol_bulletin/A21/P36.HTM as with most things Hoare has produced, it is very well written and presents a very good justification for the

[go-nuts] Suggestions for layout/structure/coding-patterns for GUI applications in Go?

2019-01-11 Thread Tom
Hi! *TL;DR: GUI applications seems pretty hard to structure the code in a readable way. Can anyone recommend any patterns/layout or suggestions to structuring such a codebase and keeping it readable?* I wrote a GUI application in Go late at night once (using gotk3). I tried to keep it

Re: [go-nuts] How to append nil using reflect

2019-01-11 Thread Xinhu Liu
Hi Josh, thanks a lot. It helps me to understand interface in go. Am Sa., 12. Jan. 2019 um 00:08 Uhr schrieb Josh Humphries < jh...@bluegosling.com>: > On Fri, Jan 11, 2019 at 5:59 PM Xinhu Liu wrote: > >> Hi Ian, >> >> thanks for your reply. >> >> After reading and experimenting a lot I think

Re: [go-nuts] How to append nil using reflect

2019-01-11 Thread Josh Humphries
On Fri, Jan 11, 2019 at 5:59 PM Xinhu Liu wrote: > Hi Ian, > > thanks for your reply. > > After reading and experimenting a lot I think I understand the slight > differences between nil and interface{} with nil value. > > The only thing I find confusing is that interface{}(nil) == nil returns >

[go-nuts] Transferring host's go-mod-download cache into docker container

2019-01-11 Thread gregoryh
Hi, I'm converting over a project from using dep to using mod and I think I have a pretty good handle on it all... but: This particular project has a dependency that is hosted on an internal git server that requires credentials. In the past it wasn't an issue because we'd just copy the vendor

Re: [go-nuts] How to append nil using reflect

2019-01-11 Thread Xinhu Liu
Hi Ian, thanks for your reply. After reading and experimenting a lot I think I understand the slight differences between nil and interface{} with nil value. The only thing I find confusing is that interface{}(nil) == nil returns true. (The reason why I use reflect on interface is that I want

[go-nuts] Opinions on monorepo multi-module build strategy

2019-01-11 Thread dan . m . moore
Hello! I'm new to the go community and am not exactly sure where the correct place to post this is (here? gophers slack? golang reddit?), so please feel free to guide me in the right direction. I'm starting a new project/monorepo using modules and I'm looking for opinions on a build

Re: [go-nuts] Re: I can assign a value to a handmade type "name" without methods and it's runnable. Why?

2019-01-11 Thread robert engels
Yes. You can use fmt.Println(name(“john”).upper()) if you uncomment the code. > On Jan 11, 2019, at 3:17 PM, 伊藤和也 wrote: > > Sorry I misunderstand it. What I did is a conversion to "name". > > 2019年1月12日土曜日 5時54分12秒 UTC+9 伊藤和也: > type name string > > /*func (n name) upper() string { >

[go-nuts] Re: I can assign a value to a handmade type "name" without methods and it's runnable. Why?

2019-01-11 Thread 伊藤和也
Sorry I misunderstand it. What I did is a conversion to "name". 2019年1月12日土曜日 5時54分12秒 UTC+9 伊藤和也: > > type name string > > /*func (n name) upper() string { >return strings.ToUpper(string(n)) > } > > func (n name) lower() string { >return strings.ToLower(string(n)) > }*/ > > func main() {

Re: [go-nuts] Re: I can assign a value to a handmade type "name" without methods and it's runnable. Why?

2019-01-11 Thread robert engels
All of the code provided runs as expected for me - what’s the issue ? > On Jan 11, 2019, at 3:07 PM, T L wrote: > > The reason is the name value is not assigned to string (the built-in type). > It is assigned to interace{}. Please read the docs of fmt.Println for details. > > On Friday,

Re: [go-nuts] Re: Wuffs: a new, memory-safe programming language

2019-01-11 Thread 'David Chase' via golang-nuts
I'm curious how much experience people have with hand-translation of one language into another. What I find is that for not-too-different languages (e.g., C to Java, or C to Modula-3) I can process about 1000 lines per day. K C to ANSI C goes a good deal more quickly. C pointers translated into

[go-nuts] Re: I can assign a value to a handmade type "name" without methods and it's runnable. Why?

2019-01-11 Thread T L
The reason is the *name* value is not assigned to *string* (the built-in type). It is assigned to *interace{}*. Please read the docs of fmt.Println for details. On Friday, January 11, 2019 at 4:54:12 PM UTC-4, 伊藤和也 wrote: > > type name string > > /*func (n name) upper() string { >return

[go-nuts] I can assign a value to a handmade type "name" without methods and it's runnable. Why?

2019-01-11 Thread 伊藤和也
type name string /*func (n name) upper() string { return strings.ToUpper(string(n)) } func (n name) lower() string { return strings.ToLower(string(n)) }*/ func main() { fmt.Println(name("john")) } -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: Wuffs: a new, memory-safe programming language

2019-01-11 Thread Eric S. Raymond
Thomas Bushnell, BSG : > On Fri, Jan 11, 2019 at 9:33 AM Eric S. Raymond wrote: > > > Thomas Bushnell, BSG : > > > Suppose it has a way, however. Now you have Go code which will have a > > > bounds fault instead of a data leak. That's better, I suppose - the > > > resulting bug is now "the

Re: [go-nuts] Re: Wuffs: a new, memory-safe programming language

2019-01-11 Thread 'Thomas Bushnell, BSG' via golang-nuts
On Fri, Jan 11, 2019 at 9:33 AM Eric S. Raymond wrote: > Thomas Bushnell, BSG : > > Suppose it has a way, however. Now you have Go code which will have a > > bounds fault instead of a data leak. That's better, I suppose - the > > resulting bug is now "the server crashes" instead of "the server

Re: [go-nuts] Re: Wuffs: a new, memory-safe programming language

2019-01-11 Thread Eric S. Raymond
Jesper Louis Andersen : > This must have been before I started reading this thread, but I know of the > CCured project by George Necula et.al, which is a C-to-C translator: > > https://web.eecs.umich.edu/~weimerw/p/p477-necula.pdf That actually looks pretty interesting. I may try testing on

Re: [go-nuts] Re: Wuffs: a new, memory-safe programming language

2019-01-11 Thread Eric S. Raymond
Thomas Bushnell, BSG : > Suppose it has a way, however. Now you have Go code which will have a > bounds fault instead of a data leak. That's better, I suppose - the > resulting bug is now "the server crashes" instead of "the server maybe > leaks a key". This is an improvement, but a

Re: [go-nuts] go test linking time issue

2019-01-11 Thread Ivan Tolstosheyev
It's go version go1.11.2 linux/amd64 now. We are flexible with go versions. On Fri, Jan 11, 2019 at 5:52 PM Ian Lance Taylor wrote: > On Fri, Jan 11, 2019 at 5:49 AM wrote: > > > > I'm working on pretty big golang project. This project consists of > several hundreds of packages, most of them

Re: [go-nuts] go test linking time issue

2019-01-11 Thread Ian Lance Taylor
On Fri, Jan 11, 2019 at 5:49 AM wrote: > > I'm working on pretty big golang project. This project consists of several > hundreds of packages, most of them are with tests. When we run tests, go test > tool does the following: > > * for each package with test files it extends this package with

Re: [go-nuts] How to set a callback for cgo ?

2019-01-11 Thread Jan Mercl
On Fri, Jan 11, 2019 at 2:49 PM wrote: > I get the file 'exit0', but didn't get the file 'exit1'. As far as I can tell, it works as expected. Exit handlers are called when libc's 'exit' is invoked. I don't think that the Go runtime does that. The proper way to handle process exiting is to

Re: [go-nuts] Re: Wuffs: a new, memory-safe programming language

2019-01-11 Thread Robert Engels
Yes, but then you just got into those performance critical routines and hand code in the bounds checks and remove the automatic checking. Still a lot less work. > On Jan 11, 2019, at 2:50 AM, Nigel Tao wrote: > >> On Fri, Jan 11, 2019 at 5:46 PM Nigel Tao wrote: >>> On Fri, Jan 11, 2019 at

Re: [go-nuts] Will golang.org/x/sys be getting a go.mod file?

2019-01-11 Thread Paul Jolly
See https://github.com/golang/go/issues/27858 and related issues. On Fri, 11 Jan 2019 at 13:49, wrote: > > Hello guys, > > Apologies if this has already been discussed but I couldn't find it. > > I've just converted a server to use modules. I did it by "go mod init > example.com/server-name" in

[go-nuts] [PATCH] encoding/asn1: Check that ObjectIdentifier has minimal encoding

2019-01-11 Thread Sergey Matveev
Greetings! I think that encoding/asn1 library should be more strict with DER-encoded objects and must check that ObjectIdentifier has minimal encoding form: without zero-values bytes at the beginning. Here is the simple patch to make that check. Sorry that I am sending it here: I can not

[go-nuts] How to set a callback for cgo ?

2019-01-11 Thread astone . chou
Hi everyone, I want to set a callback for atexit, but it seems doesn't work. This is my code. package main /* #include extern void AtExit(); static inline set_atexit() { atexit(AtExit); AtExit(); } */ import "C" import ( "fmt" "io/ioutil" "time" ) var n = 0

[go-nuts] Will golang.org/x/sys be getting a go.mod file?

2019-01-11 Thread jeff . allen
Hello guys, Apologies if this has already been discussed but I couldn't find it. I've just converted a server to use modules. I did it by "go mod init example.com/server-name" in the directory where "package main" is. I then got the latest module for each dependency by doing "go get -u". The

[go-nuts] go test linking time issue

2019-01-11 Thread itroot
Hi, All, I'm working on pretty big golang project. This project consists of several hundreds of packages, most of them are with tests. When we run tests, go test tool does the following: * for each package with test files it extends this package with *_test files of current package, create

[go-nuts] Re: Improving build times (for development) with go 1.11

2019-01-11 Thread itroot
Did you try to analyze your dependencies? Example how to do it: https://hackernoon.com/a-story-of-a-fat-go-binary-20edc6549b97 On Wednesday, January 9, 2019 at 7:45:44 AM UTC+3, hasan.abd...@mtic.co.jp wrote: > > I'm using go 1.11.2 and the build time for a small project (less than 10k > LOC)

Re: [go-nuts] Re: Wuffs: a new, memory-safe programming language

2019-01-11 Thread Nigel Tao
On Fri, Jan 11, 2019 at 5:46 PM Nigel Tao wrote: > On Fri, Jan 11, 2019 at 4:22 AM robert engels wrote: > > Again, what is wrong with the bounds checking/memory protection > > library/technique for C I referred you to? Even a decrease in performance > > will probably still be on par or better