Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant