Re: [go-nuts] Refresher tutorial

2022-12-10 Thread Ken MacDonald
Thanks, Sean & Eli for the recommendations- I’ll check them out. - Ken

Sent from my iPad

> On Dec 10, 2022, at 1:01 PM, 'Sean Liao' via golang-nuts 
>  wrote:
> 
> 
> consider something like https://learnxinyminutes.com/docs/go/
> if you just need a brief refresher on syntax/core concepts
> 
> - sean
> 
>> On Sat, Dec 10, 2022, 17:17 Ken  wrote:
>> Hi, when I first learned golang, there was a nice tutorial avaiable. I’m in 
>> need of a refresher as I haven’t used it in quite a while, but know there 
>> are 100’s of tutorials. Would like to find a recommended one where I could 
>> quickly brush up on functionality and syntax. Thanks! Ken
>> 
>> Sent from my iPhone
>> 
>> -- 
>> 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 golang-nuts+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/18BE6E52-574A-47D8-BFC7-CF9779F535DD%40gmail.com.
> 
> -- 
> 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 golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/CAGabyPoea2yS0UW0EVQRHvXP8%2B7fNZq3nkM%3DoTSU5nisOkP3tQ%40mail.gmail.com.

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/A42A6015-3D6F-4B24-AE98-B11C8F7D0679%40gmail.com.


Re: [go-nuts] Linting

2022-12-10 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2022-12-10 at 14:44 +0100, Marcello H wrote:
> golangci_lint ...
>
> Op za 10 dec. 2022 om 13:17 schreef Brian Candler
> :
> > The question remains, which linter(s) are you using?

golangci_lint is not really an answer to this question since it's just
a collection of linters, many of which have arguable utility/value.

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9827b253f9d8cc8c821874675adad2130612060e.camel%40kortschak.io.


Re: [go-nuts] Refresher tutorial

2022-12-10 Thread 'Sean Liao' via golang-nuts
consider something like https://learnxinyminutes.com/docs/go/
if you just need a brief refresher on syntax/core concepts

- sean

On Sat, Dec 10, 2022, 17:17 Ken  wrote:

> Hi, when I first learned golang, there was a nice tutorial avaiable. I’m
> in need of a refresher as I haven’t used it in quite a while, but know
> there are 100’s of tutorials. Would like to find a recommended one where I
> could quickly brush up on functionality and syntax. Thanks! Ken
>
> Sent from my iPhone
>
> --
> 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 golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/18BE6E52-574A-47D8-BFC7-CF9779F535DD%40gmail.com
> .
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGabyPoea2yS0UW0EVQRHvXP8%2B7fNZq3nkM%3DoTSU5nisOkP3tQ%40mail.gmail.com.


Re: [go-nuts] Refresher tutorial

2022-12-10 Thread Eli Bendersky
There's a good list of resources recommended at https://go.dev/learn/

Start with https://go.dev/tour/welcome/1

Then check out the official tutorials at https://go.dev/doc/tutorial/

On Sat, Dec 10, 2022 at 9:18 AM Ken  wrote:

> Hi, when I first learned golang, there was a nice tutorial avaiable. I’m
> in need of a refresher as I haven’t used it in quite a while, but know
> there are 100’s of tutorials. Would like to find a recommended one where I
> could quickly brush up on functionality and syntax. Thanks! Ken
>
> Sent from my iPhone
>
> --
> 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 golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/18BE6E52-574A-47D8-BFC7-CF9779F535DD%40gmail.com
> .
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAF-Rda88ejNAEABp%2B7oCy68YaZguNjdOBgixQ4vFFy%3DuXRo%3D7g%40mail.gmail.com.


[go-nuts] Refresher tutorial

2022-12-10 Thread Ken
Hi, when I first learned golang, there was a nice tutorial avaiable. I’m in 
need of a refresher as I haven’t used it in quite a while, but know there are 
100’s of tutorials. Would like to find a recommended one where I could quickly 
brush up on functionality and syntax. Thanks! Ken

Sent from my iPhone

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/18BE6E52-574A-47D8-BFC7-CF9779F535DD%40gmail.com.


Re: [go-nuts] Linting

2022-12-10 Thread Marcello H
golangci_lint and my own (for the cognitive code complexity)

Op za 10 dec. 2022 om 13:17 schreef Brian Candler :

> The question remains, which linter(s) are you using?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/MM3W5oNw4-0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/bd99406a-130d-4405-bbc6-4ff6ef37eca9n%40googlegroups.com
> 
> .
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CADBSaR3t31DJiYQ5o9YkyQAtqNfwsCaMsR%2BYZ6L2KAf%2BOKVWHg%40mail.gmail.com.


[go-nuts] Re: json encoder with large object (big bytes array)

2022-12-10 Thread Tamás Gulácsi
Not directly, but you can implement sth akin: 
https://go.dev/play/p/vN2uAp9rRpp
With reflection, you can build a helper that uses the exposed MarshalInto 
on types that implement it,
and falls back to Marshal otherwise.

jerome@gmail.com a következőt írta (2022. december 10., szombat, 
8:31:26 UTC+1):

> Hello,
> I would like to know if there is elegant way to json encode very long 
> field (with io.Reader)?
>
> For example: (play ground https://go.dev/play/p/QxlbNMy3ERK )
> ```
> func TestJSONStreamBytes(t *testing.T) {
> type MyStruct struct {
> Reader1 io.Reader `json:"field1"`
> Reader2 io.Reader `json:"field2"`
> }
>
> out := {}
>
> err := json.NewEncoder(out).Encode(MyStruct{
> Reader1: strings.NewReader("this stream can be very long from S3 
> Bucket for example"),
> Reader2: strings.NewReader("this stream can be very long from 
> another S3 Bucket for example"),
> })
> if err != nil {
> panic(err)
> }
>
> t.Log(out.String())
> }
> ```
> It returns prog.go:29: {"field1":{},"field2":{}}
>
> But I want base64encoded response managed as stream mode (i.e. I don't 
> want to load the data in our memory) like :
>
>
> {"field1":"dGhpcyBzdHJlYW0gY2FuIGJlIHZlcnkgbG9uZyBmcm9tIFMzIEJ1Y2tldCBmb3IgZXhhbXBsZQ==","field2":"dGhpcyBzdHJlYW0gY2FuIGJlIHZlcnkgbG9uZyBmcm9tIGFub3RoZXIgUzMgQnVja2V0IGZvciBleGFtcGxl"}
>
>
> Thank in advance,
> Jérôme
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b14b47af-fea8-4c21-8dbb-013ee30201b3n%40googlegroups.com.


Re: [go-nuts] Linting

2022-12-10 Thread Brian Candler
The question remains, which linter(s) are you using?

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/bd99406a-130d-4405-bbc6-4ff6ef37eca9n%40googlegroups.com.


Re: [go-nuts] Linting

2022-12-10 Thread Marcello H
I agree that not all linting is useful, but when I see certain outcome that 
is questionable, I would be investigating that a bit more if it was my code.
For example:
There is code that uses deprecated functionality, that could easily be 
changed to the newer version of that.

There are:
- lots of ineffective assigns to be found (which means for some occasions 
extra work for nothing)
- structs that could be made more memory efficient
- type assertions that should be checked
- unnecessary conversions
- parts with unchecked errors
- parts that have a high cognitive code complexity
  > for example "go/src/cmd/compile/internal/ssa/regalloc.go"
  func (s *regAllocState) regalloc(f *Func)
  who can read this?

So yes, linters can be useful as well

Op zaterdag 10 december 2022 om 10:30:00 UTC+1 schreef Brian Candler:

> On Friday, 9 December 2022 at 19:09:34 UTC Ian Lance Taylor wrote:
>
>> 1) Linters are optional and opinionated, and it kind of matters which 
>> linter you mean.
>
>
> And of course, go itself already comes with the grandaddy of all linters - 
> "go vet ".
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/cad99b3b-be54-4cfc-8699-edd42f01423cn%40googlegroups.com.


Re: [go-nuts] where is GOROOT set?

2022-12-10 Thread Brian Candler
On Saturday, 10 December 2022 at 05:50:53 UTC pat2...@gmail.com wrote:

> thanks, and the playground is nice.
>
> I think this is saying that if I want a baz and bar executable (chmod +x)
> then I need the "package main" in separate folders/directories
>

Yes.  The approach I use (which I borrowed from some other project) is to 
have

cmd/baz/
cmd/bar/
bin/

directories, with cmd/{baz,bar}/ containing *.go files for each 
executable.  Then at the top level,

*go build -o bin ./...*
 
will make everything, and stick the binaries in the 'bin' directory.  The 
binaries will be named after their enclosing directories, i.e. "baz" and 
"bar".  Alternatively you can build them separately, e.g.

(cd cmd/baz; go build .)

You only need a single go.mod file at the top level.  If that declares the 
module as github.com/xxx/yyy, then people can build and install your 
binaries individually as, for example,
go install github.com/xxx/yyy/cmd/baz@latest

I'm not sure the official way to install *all* the binaries at once, but 
this seems to work:
go install github.com/xxx/yyy/...@latest

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/34e9e726-9ec6-4f56-95f7-75e4cf9af194n%40googlegroups.com.


Re: [go-nuts] Linting

2022-12-10 Thread Brian Candler
On Friday, 9 December 2022 at 19:09:34 UTC Ian Lance Taylor wrote:

> 1) Linters are optional and opinionated, and it kind of matters which 
> linter you mean.


And of course, go itself already comes with the grandaddy of all linters - "go 
vet ".

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1f7d49d7-f654-4d6b-af57-7b6bac74a1f2n%40googlegroups.com.