Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: move main package into cmd/asdf and rename module for compatibility with go install #84

Open
DeedleFake opened this issue Nov 28, 2024 · 2 comments · May be fixed by #85
Open
Labels
enhancement New feature or request

Comments

@DeedleFake
Copy link

DeedleFake commented Nov 28, 2024

Is your feature request related to a problem? Please describe

Installing the new Go version is a bit strangely roundabout, especially for a Go CLI tool.

Describe the proposed solution

The convention for Go projects is to put main packages in a subdirectory of cmd named the same as what the output binary should be so that they can be easily installed with, for example, go install github.com/asdf-vm/asdf-core-go/cmd/asdf@latest. This would also make it possible to keep ASDF up to date via, for example, gup as a replacement for the removed asdf update command.

The module name will also need to be updated to follow Go conventions, changing from asdf to github.com/asdf-vm/asdf-core-go.

Describe similar asdf features and why they are not sufficient

asdf update is being removed in the Go rewrite.

Describe other workarounds you've considered

N/A.

@DeedleFake DeedleFake added the enhancement New feature or request label Nov 28, 2024
@DeedleFake DeedleFake changed the title proposal: move main package into cmd/asdf for compatibility with go install proposal: move main package into cmd/asdf and rename module for compatibility with go install Nov 28, 2024
@Stratus3D
Copy link
Member

Hi @DeedleFake , thanks for opening this issue! I'm completely new to Go - this is my first big project in Go. I was not aware of Gup and am in favor of making asdf easy to install with it. Note that most existing users of asdf either follow the manual install instructions (see the asdf website) or use their own package manager (probably brew most of the time) to install asdf. That probably won't change once this new Go version is released, but it'd be great to support go install/Gup as an additional install method for those that prefer it.

I'd be interested in a PR for this, would you be willing to open one? Alternatively, can you reference other projects that follow the pattern of putting main under cmd?

@DeedleFake
Copy link
Author

DeedleFake commented Nov 29, 2024

I might not get to it right away, but I can definitely send a PR when I do get a chance. Edit: Never mind. I was able to get to it fairly quickly.

gup isn't really a standard thing, although it has become a standard part of my toolset since I found it, but go install is, and a lot of projects generally try to support is where possible, especially CLI tools.

As for other projects that use cmd, golang.org/x/tools is structured like that. It's also recommended by the official docs.

Careful to not follow the conventions in the "Standard Go Project Layout" repo. It's not actually standard at all.

@DeedleFake DeedleFake linked a pull request Nov 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants