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

Unable to install lexer generator #393

Closed
gaiaz-iusipov opened this issue Mar 20, 2024 · 5 comments
Closed

Unable to install lexer generator #393

gaiaz-iusipov opened this issue Mar 20, 2024 · 5 comments

Comments

@gaiaz-iusipov
Copy link

The problem caused by additional cmd/participle/go.mod file:

go install github.com/alecthomas/participle/v2/cmd/participle@2.1.1
go: github.com/alecthomas/participle/v2/cmd/participle@2.1.1: github.com/alecthomas/participle/v2/cmd/participle@2.1.1: invalid version: unknown revision 2.1.1

Also scripts/participle should be updated, required module version is missing:

go install github.com/alecthomas/participle/v2/cmd/participle
go: 'go install' requires a version when current directory is not in a module
	Try 'go install github.com/alecthomas/participle/v2/cmd/participle@latest' to install the latest version
@alecthomas
Copy link
Owner

cmd/participle/go.mod is not designed to be installed remotely, as it has a replace directive. If you need static binaries they're available on the releases page.

Also scripts/participle works fine for me:

🐚 ~/dev/participle $ ./scripts/participle --help
Usage: participle <command>

A command-line tool for Participle.

Flags:
  -h, --help       Show context-sensitive help.
      --version

Commands:
  gen lexer <package> [<lexer>]
    Generate a lexer.

Run "participle <command> --help" for more information on a command.

@gaiaz-iusipov
Copy link
Author

is not designed to be installed remotely

But why limit installation and execution? Virtually any Go module is available for execution with a simple 'go run' command.

For example it would be nice to have something like:

//go:generate go run github.com/alecthomas/participle/v2/cmd/participle@2.1.1 gen lexer ...

@alecthomas
Copy link
Owner

Because it complicates the release process, which is currently: tag a commit.

The command is a separate module to avoid polluting Participle's dependencies. Without the replace, a release would entail updating the cmd's go.mod file to point to the future version, committing it, then tagging that commit with that version.

@gaiaz-iusipov
Copy link
Author

The idea is to completely remove cmd/participle/go.mod, not just the replace directive in it. This way, the release process will not change.

In my opinion, the question boils down to not having unnecessary dependencies. I believe that having the ability to use the utility via go run / go install is more important.

Besides, Go binary does not include unused dependencies.

@alecthomas
Copy link
Owner

Well, we'll agree to disagree.

Repository owner locked as resolved and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants