[go-nuts] directory name and module name not same, go tool pprof, list function faild

2020-07-29 Thread blade...@gmail.com
hi, i create a project, directory name and module name not same, and i profile it , use list command to print code and profile, it tips me not find the file, how to make it works? macbookpro:tejia_analysis fredlee$ go tool pprof http://ip:6065/debug/pprof/heap Fetching profile over HTTP fro

Re: [go-nuts] can not compile with compiler built from source code of branch dev.go2go

2020-07-29 Thread Ian Lance Taylor
On Wed, Jul 29, 2020 at 4:46 AM chen...@gmail.com wrote: > > hello, i am trying to use generic, so i install go compiler from source code. > But when i try to compile go code, it throw a error: generic functions > cannot be compiled yet. > so is that possible to build generic go code with go2go

Re: [go-nuts] Error Handling in Go 2

2020-07-29 Thread Ian Lance Taylor
On Wed, Jul 29, 2020 at 7:46 AM Kaveh Shahbazian wrote: > > Go can already pass/pipe the result of a function, which returns multiple > values, to another function, which accepts the same values as arguments. A > similar mechanism can be used for handling errors, by passing/pipe them to a > spe

Re: [go-nuts] Measuring go run and go build times?

2020-07-29 Thread Ian Lance Taylor
On Wed, Jul 29, 2020 at 2:59 PM Matt Mueller wrote: > > I'm working on a dev tool for automatically reloading the server when you > change a file. > > I'd like for the reload time to be as fast as possible. Are there any flags > or environment variables that I can set to see where the time is be

Re: [go-nuts] builtin function definitions

2020-07-29 Thread Martin Schnabel
The linked spec is the the definitive language specification. I read it carefully a couple of time (cannot recommend it enough) and knew about type switches. The most common language implementation is go's default compiler gc. Which is the place to implement the language spec and type switches

[go-nuts] gomobile + macOS + Catalyst

2020-07-29 Thread Constantine Vassilev
With macOS 10.15, users can build iPad apps to run on macOS using Catalyst. Does anyone had a success in binding for Apple Catalyst? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails f

[go-nuts] Measuring go run and go build times?

2020-07-29 Thread Matt Mueller
I'm working on a dev tool for automatically reloading the server when you change a file. I'd like for the reload time to be as fast as possible. Are there any flags or environment variables that I can set to see where the time is being spent (compiling, linking etc.)? Also seeing what packages

Re: [go-nuts] builtin function definitions

2020-07-29 Thread Shane H
On Wednesday, July 29, 2020 at 7:23:22 PM UTC+10, mb0 wrote: > > This is a special kind of switch called a type switch. You can read more > about it in the language specification where its part of the intrinsic > go syntax. https://golang.org/ref/spec#Switch_statements > > Because it is a spec

Re: [go-nuts] Custom Unmarshal multi level map

2020-07-29 Thread sbezverk
Thank you, I was suspecting that it was something simple I was missing. On 2020-07-29, 3:47 PM, "burak serdar" wrote: On Wed, Jul 29, 2020 at 1:42 PM sbezverk wrote: > > Hello, > > > > A bit of help would be much appreciated, here is the sample code: https://play.g

Re: [go-nuts] Custom Unmarshal multi level map

2020-07-29 Thread burak serdar
On Wed, Jul 29, 2020 at 1:42 PM sbezverk wrote: > > Hello, > > > > A bit of help would be much appreciated, here is the sample code: > https://play.golang.org/p/FYEC7MwU1qQ > > > > I need to Unmarshal 3 levels map. The information is stored this was as a > json doc and there is no way to flatten

[go-nuts] Custom Unmarshal multi level map

2020-07-29 Thread sbezverk
Hello, A bit of help would be much appreciated, here is the sample code: https://play.golang.org/p/FYEC7MwU1qQ I need to Unmarshal 3 levels map. The information is stored this was as a json doc and there is no way to flatten it.  This sample code works but since UnmarshalJSON method of L

Re: [go-nuts] import a file

2020-07-29 Thread jules
Thanks Kurtis and Jake. Adding jsonstuff.Prices fixed it. I have a second question related to weird behavior of using modules: --- $ go run main.go Hello golang {0} $ go env | egrep PATH GOPATH="/home/jfields/go" $ rm go.mod $ go mod init src go

Re: [go-nuts] import a file

2020-07-29 Thread jake...@gmail.com
On Tuesday, July 28, 2020 at 11:21:38 PM UTC-4 Kurtis Rader wrote: > See https://golang.org/ref/spec#Import_declarations. By default importing > a package requires using the package name to refer to any symbols it > exports; e.g., "jsonstuff.Prices". You can do "import . jsonstuff" to allow > a

[go-nuts] Error Handling in Go 2

2020-07-29 Thread Kaveh Shahbazian
Go can already pass/pipe the result of a function, which returns multiple values, to another function, which accepts the same values as arguments. A similar mechanism can be used for handling errors, by passing/pipe them to a special construct. Now, assume we have a function named funcCtx: fun

Re: [go-nuts] my package not include in go modules

2020-07-29 Thread Marvin Renich
* Ali Hassan [200725 01:04]: > I want to import libraries in module file but modules add all other > libraries except those packages which I had created, DB is one of them. How > to import? > Error , please help me > to resolve Also note th

[go-nuts] can not compile with compiler built from source code of branch dev.go2go

2020-07-29 Thread chen...@gmail.com
hello, i am trying to use generic, so i install go compiler from source code. But when i try to compile go code, it throw a error: *generic functions cannot be compiled yet.* so is that possible to build generic go code with go2go compiler? -- You received this message because you are subscr

Re: [go-nuts] Go 2018 Survey "Error handling 5%"

2020-07-29 Thread Kaveh Shahbazian
Go can already pass/pipe the result of a function, which returns multiple values, to another function, which accepts the same values as arguments. Now, assume we have a function named funcCtx: func funcCtx() (res int, err error) { // ... } Having that, these does not look that ugly: func

Re: [go-nuts] builtin function definitions

2020-07-29 Thread Martin Schnabel
This is a special kind of switch called a type switch. You can read more about it in the language specification where its part of the intrinsic go syntax. https://golang.org/ref/spec#Switch_statements Because it is a special language construct you need to look at the compiler. You probably wan

[go-nuts] Re: my package not include in go modules

2020-07-29 Thread Brian Candler
A Go module is a collection of packages. The packages are in a tree of directories (Go requires all files in one directory to be part of the same package), and there is a go.mod file at the root of the tree. Users import packages individually, not the whole module. go.mod documents the depend