Re: [go-nuts] import a file

2020-07-30 Thread Volker Dobler
On Friday, 31 July 2020 04:55:50 UTC+2, jules wrote: > > Modules are a great idea and I want to use them, but I can't get it to > compile > a "hello golang" program even: > > === > $ ls /home/jfields/go/src/jsonstuff > typestuff.go > $ go mod init src > go: creating new go.mo

Re: [go-nuts] import a file

2020-07-30 Thread Nathan Fisher
Hola! Based on your initial project layout you have a couple of issues. When using the legacy gopath everything should ideally live under that path. Imports then become relative to that root. Your main lives outside of the root which works with go run but is not how a project should be structured

[go-nuts] [ANN] GoLand 2020.2

2020-07-30 Thread Florin Pățan
Hi Gophers, I'm here with a small update about our latest release of GoLand, the Go IDE from JetBrains. In this release we worked to: - improve the Go modules support - navigate from comments to symbols definitions - add a Problems View window - add a few new inspections for things like string(i

Re: [go-nuts] import a file

2020-07-30 Thread Julian Fields
Thanks Jesper and Volker. After reading the article(s) and go help modules and a few blogs, I still was not able to see why deleting go.mod makes the program import jsonstuff package, and compile and run? Modules are a great idea and I want to use them, but I can't get it to compile a "hello golang

Re: [go-nuts] I can't install the programm

2020-07-30 Thread Kurtis Rader
On Thu, Jul 30, 2020 at 6:04 PM Jorge Dobry wrote: > I can't install the programm GO > > I have only 32 bit in my computer > > What can I do? > Go is supported on 32-bit Windows. See https://golang.org/doc/install. The download page, https://golang.org/dl/, has an installer that should work for

[go-nuts] How to allow library callers to control logging

2020-07-30 Thread 'fai...@google.com' via golang-nuts
I have a library that is used by cross platform binaries running in corp. Some of these binaries don't necessary run google.Init. My library is using base/go/log package but this doesn't work when google.Init isn't called. It prints to stderr with a message "ERROR: logging before google.Init".

[go-nuts] I can't install the programm

2020-07-30 Thread Jorge Dobry
Hi, I can't install the programm GO I have only 32 bit in my computer What can I do? Please, if anyone can help me. Thanks, Jaim -- 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 i

[go-nuts] need helps

2020-07-30 Thread El marouv Mohamed
i want to get all document , with all child , and size of array child i use go + mongodb , so i created this aggregation , lookupCurrentLoans := bson.D{ {"$lookup", bson.M{ "from": "Prets", "let": bson.M{"b_id": "$_id"}, "pipeline": bson.A{ bson.M{ "$match": bson.M{ "$expr": bson.M{ "$and": []i

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

2020-07-30 Thread Kaveh Shahbazian
In that proposal, some more syntax and semantics are being added - IMHO. One problem here is the name of the error variable. Here we explicitly have to used named return values - no new syntax there. And return() and panic() on left side, only accept error type. They will only be triggered when

Re: [go-nuts] Building application for windows server 2008 using go 1.13+

2020-07-30 Thread Maxim Via-Net
Ok, thanks, Alex I could persuade our PM's that we shouldn't support Windows Server 2008. В Вт, 28/07/2020 в 23:43 -0700, brainman пишет: > Hello Maixm, > > If you look at > > https://golang.org/doc/go1.13#windows > > page source, you will see that it says > > ``` > Windows > > > The Windows

[go-nuts] Re: Trying to scan into a struct dynamically from SQL

2020-07-30 Thread georgy . savva
Hi. I created a library that does exactly that and it's much simpler to use compared to sqlx: https://github.com/georgysavva/scany On Tuesday, December 16, 2014 at 9:08:03 PM UTC+3, Monosij Dutta-Roy wrote: > > > Hello All - > > A little new to go and reading from a SQL DBMS and trying to scan int

[go-nuts] Delve v1.5.0

2020-07-30 Thread Derek Parker
Announcing Delve v1.5.0! https://github.com/go-delve/delve/releases/tag/v1.5.0 Includes support for Go 1.15, new reload command, optimizations, bug fixes and more. Thanks to everyone who contributed to this release! -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] json.Unmarshal with disallowUnknownFields

2020-07-30 Thread Brian Candler
Sure, I now have this as a drop-in replacement for json.Unmarshal: func StrictUnmarshal(data []byte, v interface{}) error { dec := json.NewDecoder(bytes.NewReader(data)) dec.DisallowUnknownFields() return dec.Decode(v) } I just wondered if I was missing something. -- You received this message b

Re: [go-nuts] json.Unmarshal with disallowUnknownFields

2020-07-30 Thread roger peppe
You could write a function to do that for you. On Thu, 30 Jul 2020, 09:45 Brian Candler, wrote: > I want to do a json.Unmarshal of []byte data whilst also getting the > disallowUnknownFields behaviour. Is there any tidier way than this > ? > > dec := json.

Re: [go-nuts] builtin function definitions

2020-07-30 Thread jake...@gmail.com
The good news is that Go is simpler than many other languages, with fewer constructs, concepts and corner cases. So after using it for a while, you will rarely bump into anything "new". Reading the language spec is great, and I have done it myself a couple of times. But, depending on your level

Re: [go-nuts] import a file

2020-07-30 Thread Jesper Louis Andersen
On Thu, Jul 30, 2020 at 12:54 PM Volker Dobler wrote: > You dop not import files and you do > not run files and you do not test files. Files contain the > sources but are basically uninteresting: Focus on > packages (and modules). > In Go, we disconnect the name of a file and the package in whic

Re: [go-nuts] import a file

2020-07-30 Thread Volker Dobler
The best advice is: Read How to Write Go Code https://golang.org/doc/code.html and stick to it. Yes, modules are the thing to be used 1. But naming a module "src" is begging for trouble. Name your module either something like julesgocode.org/firsttry or maybe github.com//firsttry 2. If your

[go-nuts] json.Unmarshal with disallowUnknownFields

2020-07-30 Thread Brian Candler
I want to do a json.Unmarshal of []byte data whilst also getting the disallowUnknownFields behaviour. Is there any tidier way than this ? dec := json.NewDecoder(bytes.NewReader(data)) dec.DisallowUnknownFields() var v mystruct err := dec.Decode(&v) -- Yo