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

Support installing packages by go build #2131

Closed
suzuki-shunsuke opened this issue Jul 26, 2023 · 0 comments · Fixed by #2065
Closed

Support installing packages by go build #2131

suzuki-shunsuke opened this issue Jul 26, 2023 · 0 comments · Fixed by #2065
Labels
enhancement New feature or request

Comments

@suzuki-shunsuke
Copy link
Member

Feature Overview

Support installing packages by go build.

Why is the feature needed?

Because some packages couldn't be installed by go install but could be installed by go build.

aqua ever supported go type package, but it was abandoned at aqua v2 because we thought we could replace it to go_install type package.

But we found that some packages couldn't be installed by go install but could be installed by go build.

For example, suzuki-shunsuke/github-comment v5 can't be installed by go install.

$ go install github.com/suzuki-shunsuke/github-comment/v5/cmd/github-comment@v5.2.1
go: github.com/suzuki-shunsuke/github-comment/v5/cmd/github-comment@v5.2.1: github.com/suzuki-shunsuke/github-comment@v5.2.1: invalid version: module contains a go.mod file, so module path must match major version ("github.com/suzuki-shunsuke/github-comment/v5")

$ go install github.com/suzuki-shunsuke/github-comment/cmd/github-comment@v5.2.1 
go: github.com/suzuki-shunsuke/github-comment/cmd/github-comment@v5.2.1: github.com/suzuki-shunsuke/github-comment@v5.2.1: invalid version: module contains a go.mod file, so module path must match major version ("github.com/suzuki-shunsuke/github-comment/v5")

This is because github-comment's go.mod was wrong.

https://github.com/suzuki-shunsuke/github-comment/blob/e5fd429b4d1bd84e8b825a2c7b693d6ac570022f/go.mod#L1

module github.com/suzuki-shunsuke/github-comment

This issue was solved by github-comment v6, but github-comment v2 ~ v5 can't still be installed by go install.

There are many Go tools that can't be installed by go install.

How to reproduce the issue

No response

Workaround

No response

Example Code

There are two options.

  • Recover go type package
  • Improve go_install type package to support go build
packages:
  - type: github_release
    repo_owner: suzuki-shunsuke
    repo_name: github-comment
    asset: github-comment_{{trimV .Version}}_{{.OS}}_{{.Arch}}.tar.gz
    version_constraint: semver(">= 6.0.0")
    go_path: github.com/suzuki-shunsuke/github-comment/{{.Major}}/cmd/github-comment
    version_overrides:
      - version_constraint: semver("< 6.0.0")
        go_build:
          files:
            - name: github-comment
              src: ./cmd/github-comment
              dir: github-comment-{{trimV .Version}}

Reference

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
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant