pre-commit-golang | Golang hooks for pre-commit | Frontend Utils library
kandi X-RAY | pre-commit-golang Summary
kandi X-RAY | pre-commit-golang Summary
golang hooks for
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pre-commit-golang
pre-commit-golang Key Features
pre-commit-golang Examples and Code Snippets
Community Discussions
Trending Discussions on pre-commit-golang
QUESTION
I have a large repo in the likes of github.com/myusername/myrepo
Now within that repo (for reasons beyond the scope of this question) I have initialised the following go
module: github.com/myusername/myrepo/eck-user-mgmt
Here is my github.com/myusername/myrepo/eck-user-mgmt/.pre-commit-config.yaml
ANSWER
Answered 2021-Aug-24 at 17:57The go command generally runs in the context of a main module and its dependencies. It finds the main module by looking for a go.mod
file in the current working directory and its parent directories.
If your pre-commit is run in the root directory of the repository and there's no go.mod
file there, commands will be run outside any module. So go mod tidy
and go test ./...
won't do anything for example.
You'll likely need to run those commands within each module. You can locate directories containing go.mod
files in a shell script:
QUESTION
ANSWER
Answered 2020-Oct-28 at 06:47You need to source and persist changes to your PATH
env variable. If you using bash you can add next changes to .bashrc
or .bash_profile
(it's up to OS).
QUESTION
Our project uses the go standards project layout. Also, I'm using the pre-commit-hooks from pre-commit.com.
In this setup, go-vet
complains:
ANSWER
Answered 2020-Nov-12 at 09:51I dug a bit deeper in dnephin's hooks and this change to run-go-vet.sh
solved my problem
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pre-commit-golang
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page