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

error: go: go.mod file not found in current directory or any parent directory #13

Closed
0xdevalias opened this issue Jan 8, 2023 · 8 comments · Fixed by #14
Closed

error: go: go.mod file not found in current directory or any parent directory #13

0xdevalias opened this issue Jan 8, 2023 · 8 comments · Fixed by #14

Comments

@0xdevalias
Copy link
Contributor

0xdevalias commented Jan 8, 2023

While attempting to install cascadia as per:

I get the following error while trying to build:

==> go build -ldflags=-s -w
Last 15 lines from /Users/devalias/Library/Logs/Homebrew/cascadia/01.go:
2023-01-08 01:25:31 +0000

go
build
-trimpath
-o=/usr/local/Cellar/cascadia/1.2.6/bin/cascadia
-ldflags=-s -w

go: go.mod file not found in current directory or any parent directory; see 'go help modules'

Originally posted by @0xdevalias in #12 (comment)

@0xdevalias
Copy link
Contributor Author

0xdevalias commented Jan 8, 2023

Generating a 'v0 or v1 module':

⇒  git clone https://github.com/suntong/cascadia
Cloning into 'cascadia'...
remote: Enumerating objects: 314, done.
remote: Counting objects: 100% (107/107), done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 314 (delta 56), reused 61 (delta 26), pack-reused 207
Receiving objects: 100% (314/314), 84.58 KiB | 4.97 MiB/s, done.
Resolving deltas: 100% (184/184), done.

⇒  cd cascadia

⇒  go mod init
go: cannot determine module path for source directory /Users/devalias/dev/tmp/cascadia (outside GOPATH, module path must be specified)

Example usage:
	'go mod init example.com/m' to initialize a v0 or v1 module
	'go mod init example.com/m/v2' to initialize a v2 module

Run 'go help mod init' for more information.


⇒  go mod init github.com/suntong/cascadia
go: creating new go.mod: module github.com/suntong/cascadia
go: to add module requirements and sums:
	go mod tidy

⇒  go mod tidy
go: finding module for package golang.org/x/net/html
go: finding module for package github.com/PuerkitoBio/goquery
go: finding module for package github.com/andybalholm/cascadia
go: finding module for package github.com/mkideal/cli
go: finding module for package github.com/mkideal/cli/ext
go: downloading golang.org/x/net v0.5.0
go: downloading github.com/PuerkitoBio/goquery v1.8.0
go: downloading github.com/mkideal/cli v0.2.7
go: downloading github.com/andybalholm/cascadia v1.3.1
go: found github.com/PuerkitoBio/goquery in github.com/PuerkitoBio/goquery v1.8.0
go: found github.com/andybalholm/cascadia in github.com/andybalholm/cascadia v1.3.1
go: found github.com/mkideal/cli in github.com/mkideal/cli v0.2.7
go: found github.com/mkideal/cli/ext in github.com/mkideal/cli v0.2.7
go: found golang.org/x/net/html in golang.org/x/net v0.5.0
go: downloading github.com/mkideal/pkg v0.1.3
go: downloading github.com/labstack/gommon v0.3.0
go: downloading github.com/mattn/go-colorable v0.1.7
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/mkideal/expr v0.1.0
go: downloading golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
go: downloading github.com/stretchr/testify v1.4.0
go: downloading golang.org/x/sys v0.4.0
go: downloading gopkg.in/yaml.v2 v2.2.2
go: downloading github.com/davecgh/go-spew v1.1.0
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading golang.org/x/term v0.4.0

Gave me this go.mod file:

module github.com/suntong/cascadia

go 1.19

require (
	github.com/PuerkitoBio/goquery v1.8.0
	github.com/andybalholm/cascadia v1.3.1
	github.com/mkideal/cli v0.2.7
	golang.org/x/net v0.5.0
)

require (
	github.com/labstack/gommon v0.3.0 // indirect
	github.com/mattn/go-colorable v0.1.7 // indirect
	github.com/mattn/go-isatty v0.0.12 // indirect
	github.com/mkideal/expr v0.1.0 // indirect
	github.com/mkideal/pkg v0.1.3 // indirect
	golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
	golang.org/x/sys v0.4.0 // indirect
	golang.org/x/term v0.4.0 // indirect
)

@0xdevalias
Copy link
Contributor Author

@suntong
Copy link
Owner

suntong commented Jan 8, 2023

Please take a look at
https://github.com/suntong/cascadia/actions/runs/1596372916/jobs/2135287222

I.e., without go.mod it builds just fine.

I'll take a look at the CI/CD build again tomorrow.

@0xdevalias
Copy link
Contributor Author

Please take a look at
suntong/cascadia/actions/runs/1596372916/jobs/2135287222

I can't see any failed error logs/etc there, might not be visible to me? But I wonder if it's just something as simple as using an older/outdated version of go or similar?

I'll take a look at the CI/CD build again tomorrow.

Cool, sounds good :)

@suntong
Copy link
Owner

suntong commented Jan 8, 2023

I can't see any failed error logs/etc there,

Ops, check this one: https://github.com/suntong/cascadia/actions/runs/1596372915/jobs/2135287217

@0xdevalias
Copy link
Contributor Author

@suntong
Copy link
Owner

suntong commented Jan 8, 2023

Ops, now I know. thx.

@0xdevalias
Copy link
Contributor Author

No worries :)

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