Re: [go-nuts] tool directive and versioning

2025-08-13 Thread Def Ceb
When you add a tool dependency, you also get a require directicve with the version. The version is specified there. https://go.dev/doc/modules/managing-dependencies#tools On Wed, Aug 13, 2025, 16:22 Miki Tebeka wrote: > Hi, > > Does anyone know why the go.mod "tool" directive do not allow speci

Re: [go-nuts] Future hardware and Zig (cool computer science - tangential to Go)

2025-06-26 Thread Def Ceb
I've had some luck with some cross-OS Go stuff via `CGO_ENABLED=1 CC='zig cc -target ' CXX='zig c++ -target ' AR='zig ar' go build` Not a lot of nice options otherwise for MacOS. On Thu, Jun 26, 2025, 13:23 Jason E. Aten wrote: > I've been thinking maybe I should set up a blog to talk about non-

Re: [go-nuts] Use a hash/maphash uint64 as map key

2025-06-26 Thread Def Ceb
The case of having a []byte key is doable by just converting the keys to/from string, since Go strings are essentially just immutable byte slices. There'll be some overhead from all the copying if you end up having to convert a lot though. On Thu, Jun 26, 2025, 08:17 'Axel Wagner' via golang-nuts

Re: [go-nuts] The motivation for the use of length in copy function instead of the capacity

2025-05-28 Thread Def Ceb
You can, in fact, reduce the capacity. Example: https://go.dev/play/p/4SH0lRFFUXt The "full form" for slices is not a frequently used feature though. https://go.dev/ref/spec#Slice_expressions This can also be used to reslic a slice to access the data between the length and capacity. On Wed, May

Re: [go-nuts] Question About Interface Field in a Structure

2025-05-23 Thread Def Ceb
You're creating new copies of the values and modifying the copies, rather than storing a reference and then modifying the original data through it. You'd use *string and *bool there to have both change. This would be somewhat tedious and involve a good amount of type casting though, if you were to

Re: [go-nuts] latest geth stable version

2025-03-11 Thread Def Ceb
I'll take a wild guess and use this package for the examples: github.com/ethereum/go-ethereum/ethclient/gethclient Option 1: check the version control system used for this package, e.g the github repo, for tagged versions and v2/v3 branches. e.g https://github.com/ethereum/go-ethereum/tags or clon

Re: [go-nuts] removing one slice elements from another

2025-02-12 Thread Def Ceb
The function passed to DeleteFunc should accept a single element and return a boolean indicating whether it should be removed. You could do this: lhr = slices.DeleteFunc(lhr, func(n uint) bool { return slices.Contains(lhr_del, n) }) Jabari Zakiya: I have two slice, lhr and lhr_dels. I want t

Re: [go-nuts] Passing Option argument while Aptos Contract Method

2025-01-17 Thread Def Ceb
There is no (official) option type in Go in general. I am also not very sure where you took that function signature for the mint function from. The only place I could find it was your Github issue with the exact same contents as this email, and there did not seem to be a direct parallel in the

Re: [go-nuts] List of source code files of a Go binary

2025-01-01 Thread Def Ceb
There are two places where this information can come from: the pclntab, and DWARF debug information. The pclntab has a mapping from program counter locations to filenames and line numbers, which makes stack traces more useful. Files which don't contain any code, only things like type definition

Re: [go-nuts] Is it necessary to change the behavior of maps.Keys and maps.Values?

2024-12-24 Thread Def Ceb
x/exp/maps.Keys() returned a slice, while stdlib maps.Keys() returns an iterator. Can't just switch between them transparently in almost all cases. Sebastian was simply saying that slices.Collect() could be used as a stop-gap solution for moving from x/exp/maps to stdlib maps, since every curren

Re: [go-nuts] Re: Map with expiration

2024-10-08 Thread Def Ceb
I've found this package to be useful for this in the past: https://github.com/jellydator/ttlcache On Wed, Oct 9, 2024, 04:31 Cleberson Pedreira Pauluci < pauluci.cleber...@gmail.com> wrote: > Hello. I found this very interesting. > > I have some questions: > > Have you considered the possibility

Re: [go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-28 Thread Def Ceb
Most marshal/unmarshal functions are unwilling to marshal/unmarshal structs with pointer fields. Changing them to direct values fixes this. Example: https://go.dev/play/p/ykmpBm0bXqn I do not think there is any other simple alternative. J Liu: I understand this problem. My real program uses expo

Re: [go-nuts] Which part of go compiler set the symbol "runtime.text" in the final build?

2024-01-24 Thread Def Ceb
The binary stores a lot of ancillary data for runtime access. This (mostly?) spans out from runtime.pclntab and runtime.firstmoduledata and all the structures referenced by them. This is uniform across all platforms too, with the runtime doing the same operations across different OS-es and exec

Re: [go-nuts] Is it possible to build a Go binary without the runtime ?

2024-01-23 Thread Def Ceb
an do "go tool objdump module.a" and get the assembly for your module. On Tue, Jan 23, 2024 at 4:14 PM Def Ceb <mailto:mikk.mar...@gmail.com>> wrote: Interesting proposition, though from what I can tell, you're just going to end up with goobj files, a

Re: [go-nuts] Is it possible to build a Go binary without the runtime ?

2024-01-23 Thread Def Ceb
chive (go build -buildmode=archive) and then disassemble/decompile the library. On Tue, Jan 23, 2024 at 3:18 PM Def Ceb <mailto:mikk.mar...@gmail.com>> wrote: No, this is not possible. This is the case for practically every other language, even C. Unless you intend on inspecting as

Re: [go-nuts] How to control the way a type is printed out

2024-01-23 Thread Def Ceb
Is there any particular reason to compare with %T fmt.Sprintf(?) values in the first place? If not, then you could just use type assertions. And the reflect package if really needed. notevenhere: I have some types defined within their respective packages deep inside my project folder structur

Re: [go-nuts] Is it possible to build a Go binary without the runtime ?

2024-01-23 Thread Def Ceb
No, this is not possible. This is the case for practically every other language, even C. Unless you intend on inspecting assembly text instead of a real working binary. The symbol table + debug symbols built into the binary by default should make finding the `main.main` function trivial with jus

Re: [go-nuts] go build at most 37x slower in 1.21.5 vs 1.19.3

2023-12-13 Thread Def Ceb
The Go blog does indeed say this. > The go tool no longer relies on pre-compiled standard library package archives in the $GOROOT/pkg directory, and they are no longer shipped with the distribution, resulting in smaller downloads. Instead, packages in the standard library are built as needed an

Re: [go-nuts] Go ARM

2023-11-15 Thread Def Ceb
I downloaded and ran `go env` with both the 32-bit and 64-bit Go toolchains from go.dev, and the GOGCCFLAGS results were: 64-bit: GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2828356582=/tmp/go-build -gno-record-gcc-switches' 32-bit: GOGC

Re: [go-nuts] Reduce memory usage via reduced padding?

2023-04-18 Thread Def Ceb
rue. I was working off of go.dev/s/regabi and it seemed to imply that there's a lot less padding at the end of a struct. > If there is a real performance difference, then, sure. Fair enough, I'll try and check. On Tuesday, April 18, 2023 at 7:56:07 PM UTC Ian Lance Taylor wrote: O

[go-nuts] Re: Reduce memory usage via reduced padding?

2023-04-18 Thread Def Ceb
come prominent. > > On Tuesday, April 18, 2023 at 7:54:17 PM UTC+2 Def Ceb wrote: > >> Hello. >> This is a request for comments on an idea I had. >> >> While working on a personal project, I noticed that quite a few structs >> in the standard library, exported

[go-nuts] Reduce memory usage via reduced padding?

2023-04-18 Thread Def Ceb
Hello. This is a request for comments on an idea I had. While working on a personal project, I noticed that quite a few structs in the standard library, exported or otherwise, could have their memory footprint reduced by simply reordering their members so that padding required for alignment is