Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go build doesnt run if i have code under src directory #50

Open
rupamkhaitan opened this issue Jun 23, 2020 · 1 comment
Open

go build doesnt run if i have code under src directory #50

rupamkhaitan opened this issue Jun 23, 2020 · 1 comment

Comments

@rupamkhaitan
Copy link

rupamkhaitan commented Jun 23, 2020

There should be a way to pass the main.go which get executed under src directory (allowing through args is better option)
Also an option to pass flags for go tags when building the project (eg: go build -tags <my_custom_tag> .)

https://golang.org/pkg/go/build/

code_dir/
  .pre-commit-config.yaml
   src/
       main.go
       go.mod
       go.tidy
       <other_nested_folder>
@rupamkhaitan rupamkhaitan changed the title GO build doesnt run if i have code under src directory go build doesnt run if i have code under src directory Jun 23, 2020
@rupamkhaitan
Copy link
Author

I see below error when enabling go build in .pre-commit-config.yaml


go-build..................................................Failed

hook id: go-build
exit code: 1
go: warning: "./..." matched no packages
go: cannot find main module, but found .git/config in /Users/myspace/code_dir/
to create a module there, run:
go mod init
go: warning: "./..." matched no packages
go: cannot find main module, but found .git/config in /Users/myspace/code_dir/
to create a module there, run:
go mod init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant