2024-03-07 00:50:58 -06:00
|
|
|
# go-clone
|
2024-11-07 04:59:54 -06:00
|
|
|
In 2018, [gohack](https://github.com/rogpeppe/gohack) was written for the same reasons
|
|
|
|
this tool was written. gohack has a good justification for this kind of tool.
|
2024-03-21 19:43:26 -05:00
|
|
|
|
2024-11-07 04:57:07 -06:00
|
|
|
## Install go-glone
|
|
|
|
|
|
|
|
go install go.wit.com/apps/go-clone@latest
|
|
|
|
|
|
|
|
## go-glone itself
|
|
|
|
|
2024-11-15 13:25:52 -06:00
|
|
|
This will download the sources for go-clone:
|
2024-11-07 04:57:07 -06:00
|
|
|
|
|
|
|
go-clone go.wit.com/apps/go-clone
|
|
|
|
|
2024-11-15 13:25:52 -06:00
|
|
|
go-clone works in ~/go/src unless it finds a go.work file in a parent dir
|
|
|
|
If you are using a go.work file, this will autocreate one. The old
|
|
|
|
one is saved as go.work.last
|
|
|
|
|
|
|
|
go-clone --auto-work go.wit.com/apps/go-clone
|
|
|
|
|
2024-11-07 04:59:54 -06:00
|
|
|
Or to recursively clone all the build dependancies:
|
2024-11-07 04:57:07 -06:00
|
|
|
|
|
|
|
go-clone --recursive go.wit.com/apps/go-clone
|
2024-03-21 19:43:26 -05:00
|
|
|
|
2024-11-07 07:03:51 -06:00
|
|
|
## debian packages
|
|
|
|
|
|
|
|
Debian packages are at mirrors.wit.com
|
|
|
|
|
2024-11-07 04:59:54 -06:00
|
|
|
## TODO:
|
|
|
|
|
|
|
|
* use protobuf
|
|
|
|
* move edge case mappings to a config file
|
2024-11-22 20:50:55 -06:00
|
|
|
* figure out how to detect gooogle.golang.org mapping with 'go list'
|
2024-11-07 04:59:54 -06:00
|
|
|
|
2024-11-15 13:25:52 -06:00
|
|
|
## these are notes from Gohack: mutable checkouts of Go module dependencies
|
2024-03-21 19:43:26 -05:00
|
|
|
|
|
|
|
The new Go module system is awesome. It ensures repeatable, deterministic
|
|
|
|
builds of Go code. External module code is cached locally in a read-only
|
|
|
|
directory, which is great for reproducibility. But if you're used to the
|
|
|
|
global mutable namespace that is `$GOPATH`, there's an obvious question:
|
|
|
|
what if I'm hacking on my program and I *want* to change one of those
|
|
|
|
external modules?
|
|
|
|
|
|
|
|
You might want to put a sneaky `log.Printf` statement to find out how
|
|
|
|
some internal data structure works, or perhaps try out a bug fix to see
|
|
|
|
if it solves your latest problem. But since all those external modules
|
|
|
|
are in read-only directories, it's hard to change them. And you really
|
|
|
|
don't want to change them anyway, because that will break the integrity
|
|
|
|
checking that the Go tool does when building.
|
|
|
|
|
|
|
|
Luckily the modules system provides a way around this: you can add a
|
|
|
|
`replace` statement to the `go.mod` file which substitutes the contents
|
|
|
|
of a directory holding a module for the readonly cached copy. You can of
|
|
|
|
course do this manually, but gohack aims to make this process pain-free.
|