Closed sebd71 closed 2 years ago
Additional information :
after more investigations, it seems that info.Module.Path
is empty when running buffalo task list
/ grift tool (grift/cli/run.go#L27).
info.Module.Path
is set by here
package using go list -json
command (see dir.go#33 ) and go list -json
no longer works due to the fact that there is no main.go in the root directory of coke app (main.go is now under cmd/app/main.go
.
seb@seb-laptop: /tmp/coke(master)$ cd coke
seb@seb-laptop: /tmp/coke(master)$ ls -l
total 232K
drwxr-xr-x 2 seb seb 4,0K juil. 4 21:30 actions/
drwxrwxr-x 2 seb seb 4,0K juil. 4 21:31 bin/
drwxr-xr-x 3 seb seb 4,0K juil. 4 21:30 cmd/
drwxr-xr-x 2 seb seb 4,0K juil. 4 21:30 config/
-rw-rw-r-- 1 seb seb 371 juil. 4 21:30 database.yml
-rw-rw-r-- 1 seb seb 972 juil. 4 21:30 Dockerfile
drwxr-xr-x 2 seb seb 4,0K juil. 4 21:30 fixtures/
-rw-rw-r-- 1 seb seb 4,3K juil. 4 21:31 go.mod
-rw-rw-r-- 1 seb seb 172K juil. 4 21:30 go.sum
drwxr-xr-x 2 seb seb 4,0K juil. 4 21:30 grifts/
-rw-rw-r-- 1 seb seb 26 juil. 4 21:30 inflections.json
drwxr-xr-x 2 seb seb 4,0K juil. 4 21:30 locales/
drwxr-xr-x 2 seb seb 4,0K juil. 4 21:31 migrations/
drwxr-xr-x 2 seb seb 4,0K juil. 4 21:30 models/
-rw-rw-r-- 1 seb seb 1,3K juil. 4 21:30 README.md
seb@seb-laptop: /tmp/coke(master)$ go list -json
no Go files in /tmp/coke
If I create a "fake" / empty main.go, all is back to normal :
seb@seb-laptop: /tmp/coke(master)$ echo "package main" > main.go
seb@seb-laptop: /tmp/coke(master)$ go list -json
{
"Dir": "/tmp/coke",
"ImportPath": "coke",
"Name": "main",
"Target": "/home/seb/local/go/bin/coke",
"Root": "/tmp/coke",
"Module": {
"Path": "coke",
"Main": true,
"Dir": "/tmp/coke",
"GoMod": "/tmp/coke/go.mod",
"GoVersion": "1.17"
},
"Match": [
"."
],
"Stale": true,
"StaleReason": "build ID mismatch",
"GoFiles": [
"main.go"
],
"Deps": [
"internal/abi",
"internal/bytealg",
"internal/cpu",
"internal/goexperiment",
"runtime",
"runtime/internal/atomic",
"runtime/internal/math",
"runtime/internal/sys",
"unsafe"
]
}
seb@seb-laptop: /tmp/coke(master)$ buffalo task list
Available grifts
================
buffalo task db:seed # Seeds a database
buffalo task middleware # Prints out your middleware stack
buffalo task routes # Print out all defined routes
buffalo task secret # Generate a cryptographically secure secret key
So is there a way to make go list
working even if there is no .go file in root directory ?
or does here
code must be updated in order to retrieve ImportPath
even if there is no .go file in root directory ?
Let me know if it's better to log a bug in here
package.
Thanks for filing a report!
This is a duplicate of gobuffalo/cli#142 and #2268. (The buffalo
command is provided by cli
package).
The buffalo v0.18.5 and above (the latest version is v0.18.6) was shipped with the fix.
Thanks a lot and sorry for the dups. I had looked at the issues but did not see those ones.
Thanks a lot and sorry for the dups. I had looked at the issues but did not see those ones.
No problem at all! Your report will help others to find the solution of the issue too, and we are sorry for inconvenience!
Description
Grifts tasks seems not work / build with go 1.17. Command task list returns following error :
Steps to Reproduce the Problem
Create simple example, eg. coke and list grifts tasks
Expected Behavior
buffalo task list should work as expected.
Questions
Is something wrong in my setup or is it a bug with grift tasks and new go 1.17 behavior ? I read and try to play with GO111MODULE=off/auto/on without succes.