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
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-
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
22 matches
Mail list logo