8 ms·
I've never used Go, but do you really not need to create anything similar to a Cargo.toml file specifying dependencies to create a package? That doesn't seem li
by thurn 3y ago
I've never used Go, but do you really not need to create anything similar to a Cargo.toml file specifying dependencies to create a package? That doesn't seem like it could be true within Google since they would use blaze to compile their Go code, which mandates a new BUILD file for each package...
The other stuff here is mostly just a matter of convention. Every large Rust codebase I'm familiar with absolutely does avoid creating huge crates, so I think the author is just mistaken about what constitutes standard Rust practice.
- pclmulqdq 3y agoThere is no required cargo.toml equivalent for go. You put all dependencies at the top of your source code in an import statement. There are other things you can do if you want to lock a specific version of an API.
- TheDong 3y agoOkay, let me try that: $ echo -e 'package main\n\nimport _ "golang.org/x/image/draw"' > main.go $ go run main.go main.go:3:8: no required module provides package golang.org/x/image/draw: go.mod file not found in current directory or any parent directory; see 'go help modules' $ go build main.go <same error> go.mod seems pretty required. With rust, you can also technically just call 'rustc' and never use 'cargo', but just like it's a pain to do that in go, it's a pain to do that in rust.
- silisili 3y agoWith Go at least, just prepend GO111MODULE=off and it works. A bit esoteric, but I like that option, especially when working on an application and its dependencies in parallel at times.
- 2h 3y agosibling comment is wrong. this is the typical flow on a new package: 1. go mod init something # create go.mod 2. go mod tidy # create go.sum 3. have fun
- foldr 3y agoThat’s a new module in Go parlance. Making a new package just requires making a new directory.