Comments (3)
There is a reason why the Go team doesn't provides a package to edit go.mod
: the official go.mod
editing API is go mod edit
.
So gohack
should just use go mod edit
commands instead of editing the file itself.
from gohack.
Beware that gohack
came out very early in the timeline of modules, before tools like go mod edit
were fully developed.
Also, note that there is in fact a package to parse and print go.mod files: https://pkg.go.dev/golang.org/x/mod/modfile
from gohack.
The fact is that you have to keep in sync the version of your Go toolchain with any other tools that have go.mod
editing capabilities.
For gohack
to maintain compability with Go toolchain upgrades:
- the gohack maintainers have to keep to go.mod editing editing in sync with the toolchain (and that doesn't happen: the fact that
github.com/rogpeppe/go-internal/modfile
hasn't been updated for 2 years just shows that doesn't work) - the end user has to update
gohack
when (s)he updates the toolchain with agohack
that has upgraded its go.mod support.
That isn't sustainable.
golang.org/x/mod/modfile
can help to solve the first point (but that would still require that the gohack maintainers to upgrade the dependency in case of a new go.mod
format change), but that will never fix the second point.
So go mod edit
is the only sustainable way.
from gohack.
Related Issues (20)
- getting permission denied error HOT 3
- implement undo -rm
- gohack get -vcs failed with incompatible pathspec HOT 1
- gohack does not allow relative directories in GOHACK env var. HOT 2
- Ran gohack get github.com/user/somerepo and it is missing the .git directory HOT 1
- bitbucket.org issues
- cannot undo if directory has been removed
- README: perhaps briefly explain how to work with a fork, including pushing a change to the fork?
- Use existing dependency code source from the GOPATH HOT 4
- Idea: flag for "fork" remote HOT 2
- proposal: add command to determine if commit is ancestor of module version
- add 'gohack promote' or 'gohack undo -get' HOT 2
- add 'gohack list' or shell completion support HOT 4
- accept package path in 'gohack get' HOT 2
- gohack redo
- cannot get module info HOT 4
- Imply module name from $PWD HOT 5
- support linked file in gohack directory HOT 1
- supporting workspaces? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gohack.