gizak / termui

Golang terminal dashboard
MIT License
13.23k stars 786 forks source link

v3 is no longer working for go dep etc? #234

Closed uschen closed 5 years ago

uschen commented 5 years ago

it seems this is due to there is no v3 directory, per https://github.com/golang/go/wiki/Modules

Major subdirectory: Create a new v3 subdirectory (e.g., my/module/v3) and place a new go.mod file in that subdirectory. The module path must end with /v3. Copy or move the code into the v3 subdirectory. Update import statements within the module to also use /v3 (e.g., import "github.com/my/module/v3/mypkg"). Tag the release with v3.0.0.

This provides greater backwards compatibility. In particular, Go versions older than 1.9.7 and 1.10.3 are also able to properly consume and build a v2+ module created using this approach. A more sophisticated approach here could exploit type aliases (introduced in Go 1.9) and forwarding shims between major versions residing in different subdirectories. This can provide additional compatibility and allow one major version to be implemented in terms of another major version, but would entail more work for a module author. An in-progress tool to automate this is goforward. Please see here for more details and rationale, along with a functioning initial version of goforward.

cjbassi commented 5 years ago

Hmm, that's unfortunate. So the only solution is to create a v3 subdirectory? If so, then that's fine.

edit: Just out of curiosity, what's the reason for not upgrading to Go modules?

uschen commented 5 years ago

edit: Just out of curiosity, what's the reason for not upgrading to Go modules?

@cjbassi not sure how to answer this except... there are always reasons for not upgrading to go modules, legacy, ci/cd config, laziness etc etc.

shane-oliver commented 5 years ago

Have to agree the /v3 missing appears to be causing this not to work.

go build main.go main.go:6:2: cannot find package "github.com/gizak/termui/v3" in any of: /usr/local/go/src/github.com/gizak/termui/v3 (from $GOROOT) /home/user/GO_Code/src/github.com/gizak/termui/v3 (from $GOPATH) main.go:7:2: cannot find package "github.com/gizak/termui/v3/widgets" in any of: /usr/local/go/src/github.com/gizak/termui/v3/widgets (from $GOROOT) /home/user/GO_Code/src/github.com/gizak/termui/v3/widgets (from $GOPATH)

After creating the v3 and v3/widgets directories I get these errors: main.go:6:2: no Go files in /home/user/GO_Code/src/github.com/gizak/termui/v3 main.go:7:2: no Go files in /home/user/GO_Code/src/github.com/gizak/termui/v3/widgets

So if someone could please create a post / document on how you are supposed to install this.

cjbassi commented 5 years ago

I got it to work by removing the /v3 in the import path. Can you test that?

shane-oliver commented 5 years ago

Thanks cjbassi, removing the /v3 from both import lines fixed all issues. Many thanks

cjbassi commented 5 years ago

I just added instructions to the readme about installing termui with dep. Let me know if there's any issues with the instructions. I might opt into using a v3 subdirectory at some point but I think this should be fine for now.