eliukblau / pixterm

Draw images in your ANSI terminal with true color
Mozilla Public License 2.0
971 stars 52 forks source link

more conventional single go.mod at the repo root #15

Closed MichaelMure closed 4 years ago

MichaelMure commented 4 years ago

The vast majority of go module package have a single go.mod at the root. With the way it's done at the moment, go get a bit confused. You can't import only the ansimage package with the tag and you have to import with a commit hash (github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75).

Note: having the pixterm command in the same go module in not really a problem. go.mod define a coherent set of file as a package, not a compilation unit. It's entirely valid to import the whole thing and only use (and compile) ansimage. If you really want to separate the two, you can either split the command into its own repo or add another go.mod for the command while keeping the root one.

Also, the replace directive, while working, is really something that should be used only for advanced use cases like a local fork.

I understand that you structured the project according to https://github.com/golang-standards/project-layout, but they also say that the layout will need to be changed for go modules.

Also, it compiles without problem with go 1.12.

eliukblau commented 4 years ago

You are totally right :) Anyway, "replace" directive is used not only for local: other projects exists that use "replaced" packages for specific reasons (code order, package separation, subpackages or submodules, etc.). But, in our case, this is not necessary, as you say.

Can you confirm if the app continues to compile correctly by using the following command?

go get -u github.com/eliukblau/pixterm/cmd/pixterm

If this is so, I will merge the PR immediately :). Thanks for contributing šŸ‘

eliukblau commented 4 years ago

Added in v1.3.1 @MichaelMure check your name in -credits option and README.md šŸ˜‰