-
Notifications
You must be signed in to change notification settings - Fork 0
Serve command fails when using go workspaces #8
Copy link
Copy link
Open
Description
Related code
fairytale/cmd/fairytale/cmd/serve.go
Lines 116 to 119 in 955ed7c
| out, err := exec.Command("go", "list", "-json", "-m").Output() | |
| cobra.CheckErr(err) | |
| var mod moduleList | |
| cobra.CheckErr(json.Unmarshal(out, &mod)) |
The go list -json -m command normally returns the following JSON inside the senet repo:
{
"Path": "github.com/macabot/senet",
"Main": true,
"Dir": "/home/user/repos/github.com/macabot/senet",
"GoMod": "/home/user/repos/github.com/macabot/senet/go.mod",
"GoVersion": "1.23.0"
}However, it returns multiple JSON objects when there is a go.work file in the macabot directory:
{
"Path": "github.com/macabot/hypp",
"Main": true,
"Dir": "/home/user/repos/github.com/macabot/hypp",
"GoMod": "/home/user/repos/github.com/macabot/hypp/go.mod",
"GoVersion": "1.23.0"
}
{
"Path": "github.com/macabot/senet",
"Main": true,
"Dir": "/home/user/repos/github.com/macabot/senet",
"GoMod": "/home/user/repos/github.com/macabot/senet/go.mod",
"GoVersion": "1.23.0"
}This can't be parsed by json.Unmarshal, which gives the error:
invalid character '{' after top-level value
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels