Giter Club home page Giter Club logo

here's People

Contributors

markbates avatar sio4 avatar stanislas-m avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

here's Issues

here does not function from within a go workspace

Go 1.18 introduced workspaces (https://go.dev/doc/tutorial/workspaces) defined by a go.work file defined in the parent directory of a module - these are useful for working with private packages, etc.

I have a setup where my buffalo project depends on a private "common" module for my organisation, and therefore I develop within a go workspace using the following directory structure:

matt@argon:~/ws$ ls
common  go.work  web

Where web contains my buffalo project, common is the private module, and go.work defined the go workspace.

Unfortunately attempting to use many buffalo-cli commands within this workspace fails with the following error:

matt@argon:~/ws/web$ buffalo task list
Usage:
  buffalo task [flags]

Aliases:
  task, t, tasks

Flags:
  -h, --help   help for task

ERRO[0000] Error: here.Dir: /home/matt/ws/web: here.cache: /home/matt//ws/web: here.nonGoDir: /home/matt//ws/web: invalid character '{' after top-level value 

The issue appears to be that the here module is unable to handle the JSON returned by go list when executed under a workspace, specifically the output of go list -json -m (called by https://github.com/gobuffalo/here/blob/main/dir.go#L71) returns multiple JSON objects (not in a JSON array!), which then raises the error above when the output is parsed to json.Unmarshal on the following lines...

Example go list output:

matt@argon:~/ws/web$ go list -json -m
{
	"Path": "github.com/MYORG/common",
	"Main": true,
	"Dir": "/home/matt//ws/common",
	"GoMod": "/home/matt//ws/common/go.mod",
	"GoVersion": "1.18"
}
{
	"Path": "github.com/MYORG/web",
	"Main": true,
	"Dir": "/home/matt/ws/web",
	"GoMod": "/home/matt/ws/web/go.mod",
	"GoVersion": "1.18"
}

While arguably this is a go list bug for returning multiple JSON objects outside of a JSON array, the fact that there's a released version of go doing this, to me means that this output format needs to be supported by the here command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.