[go-nuts] Building a Package With Multiple Subdirectories?

2022-11-21 Thread jlfo...@berkeley.edu
Back in June I asked why Go requires all the files in a package to be in the same directory. I learned that this is an implementation-specific decision. I was also referred to https://stackoverflow.com/questions/45899203/can-i-develop-a-go-package-in-multiple-source-directories which discusses

[go-nuts] Go Devroom at FOSDEM 2023

2022-11-21 Thread Maartje Eyskens
Hi gophers! We have good news: the Go Devroom will be happening again at FOSDEM 2023 in Brussels! And this time it will be in person again! We really hope to se you all again on 4 February 2023 for a day of Go-related talks and fun. Like always we're looking for speakers who want to deliver a t

[go-nuts] Re: How to read struct field names from an empty slice of structs

2022-11-21 Thread 'Mark' via golang-nuts
After struggling, I finally solved it; playground On Monday, November 21, 2022 at 10:55:06 AM UTC Mark wrote: > I have a two level general-purpose data structure: a struct containing one > or more slices of structs. > I want to be able to use reflection to po

[go-nuts] How to read struct field names from an empty slice of structs

2022-11-21 Thread 'Mark' via golang-nuts
I have a two level general-purpose data structure: a struct containing one or more slices of structs. I want to be able to use reflection to populate this, but as a first step I want to extract the "table names" (i.e., the names of the fields of the outer struct), and the "field names" (the nam

Re: [go-nuts] Int64 to []byte and vice-versa

2022-11-21 Thread 'Axel Wagner' via golang-nuts
Use `encoding/binary`. Yes, you have to care about byte order. But that's inherent to the question. There is no canonical way in which an integer correspond to a slice of bytes, you actually have to say how to encode it. That also doesn't cause any problems - on the contrary, being explicit about t

Re: [go-nuts] Int64 to []byte and vice-versa

2022-11-21 Thread Jan Mercl
On Mon, Nov 21, 2022 at 9:57 AM Nikhilesh Susarla wrote: > I have an int64 value say 12 > I want to convert that to []byte array. Such conversion is not supported. Also, []byte is a slice. However, the desired result can be computed in code. You can use the encoding/binary package for that. End

[go-nuts] Int64 to []byte and vice-versa

2022-11-21 Thread Nikhilesh Susarla
Hi, I have an int64 value say 12 I want to convert that to []byte array. How do we do that. There were lot of ways on the internet. Nothing which golang specifies or has a built-package for direct conversions. Lot of them dealt with Endiean's, but that might cause issues to I believe. So, is

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

2022-11-21 Thread Brian Candler
On Monday, 21 November 2022 at 04:11:26 UTC pat2...@gmail.com wrote: > > Incidentally, there is no need to have github.com in the directory path >> on your local filesystem. You could just use >> ~/projects/cmd >> > > Doesn't this contradict putting the github path in the name for easy > automa