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

golangci-lint version format in macOS is different than other platforms #157626

Closed
jsolana opened this issue Dec 18, 2023 · 4 comments
Closed

golangci-lint version format in macOS is different than other platforms #157626

jsolana opened this issue Dec 18, 2023 · 4 comments
Labels
outdated PR was locked due to age upstream issue An upstream issue report is needed

Comments

@jsolana
Copy link

jsolana commented Dec 18, 2023

brew gist-logs <formula> link OR brew config AND brew doctor output

brew config


HOMEBREW_VERSION: 4.1.25
ORIGIN: https://github.com/Homebrew/brew
HEAD: c32bd1c7cc0c3b1b914845bddfeda53f4d877a3f
Last commit: 11 days ago
Core tap JSON: 17 Dec 08:53 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.1.4 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit icelake
Clang: 13.1.6 build 1316
Git: 2.39.0 => /usr/local/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.5.1-x86_64
CLT: 13.4.0.0.1.1651278267
Xcode: N/A


brew doctor

```console
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences.

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.2.


Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  [email protected]
  [email protected]
  prototool

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  [email protected]

Warning: Homebrew's "sbin" was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting your PATH for example like so:
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc


### Verification

- [X] My "`brew doctor` output" says `Your system is ready to brew.` and am still able to reproduce my issue.
- [X] I ran `brew update` and am still able to reproduce my issue.
- [X] I have resolved all warnings from `brew doctor` and that did not fix my problem.
- [X] I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

### What were you trying to do (and why)?

In macOS, after run `brew install golangci-lint`,  `golangci-lint version` returns its  version in different format.

```console
golangci-lint version
golangci-lint has version 1.55.2 built with go1.21.3 from e3c2265 on 2023-11-02T21:40:02Z

Instead of vMajor.minor.patch that is the expected in other platforms.
Eg using docker alternative:

docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.55.2 golangci-lint version

golangci-lint has version v1.55.2 built with go1.21.3 from e3c2265f on 2023-11-03T13:27:54Z

Related to issue

What happened (include all command output)?

golangci-lint version
golangci-lint has version 1.55.2 built with go1.21.3 from e3c2265 on 2023-11-02T21:40:02Z

What did you expect to happen?

Return a vMajor.minor.patch format version.
Eg using docker alternative:

docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.55.2 golangci-lint version

golangci-lint has version v1.55.2 built with go1.21.3 from e3c2265f on 2023-11-03T13:27:54Z

Step-by-step reproduction instructions (by running brew commands)

brew install golangci-lint

golangci-lint version


We can solve the problem [here](https://github.com/Homebrew/homebrew-core/blob/56b593d11f0fadf7f63b0b437a5cb520c83489e1/Formula/g/golangci-lint.rb#L25) adding:


def install
    ldflags = %W[
      -s -w
      -X main.version="v#{version}"
      -X main.commit=#{Utils.git_short_head(length: 7)}
      -X main.date=#{time.iso8601}
    ]

    system "go", "build", *std_go_args(ldflags: ldflags), "./cmd/golangci-lint"

    generate_completions_from_executable(bin/"golangci-lint", "completion")
  end
@jsolana jsolana added the bug Reproducible Homebrew/homebrew-core bug label Dec 18, 2023
@alebcay
Copy link
Member

alebcay commented Dec 18, 2023

The binary releases distributed at https://github.com/golangci/golangci-lint/releases don't seem to have a v prefix when running golangci-lint --version - maybe this is worth raising upstream, since this is inconsistent in what they distribute (standalone binaries vs container images).

Once upstream settles on one pattern or the other, we can follow the same here.

@ZhongRuoyu ZhongRuoyu added the upstream issue An upstream issue report is needed label Dec 18, 2023
@cho-m cho-m removed the bug Reproducible Homebrew/homebrew-core bug label Dec 18, 2023
@alebcay
Copy link
Member

alebcay commented Dec 18, 2023

Opened golangci/golangci-lint#4268 for this.

@alebcay
Copy link
Member

alebcay commented Dec 21, 2023

Opened golangci/golangci-lint#4279 upstream to fix.

@cho-m
Copy link
Member

cho-m commented Dec 24, 2023

Closing as there is nothing to do on Homebrew side given issue was in Docker images.

@cho-m cho-m closed this as completed Dec 24, 2023
@github-actions github-actions bot added the outdated PR was locked due to age label Jan 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age upstream issue An upstream issue report is needed
Projects
None yet
Development

No branches or pull requests

4 participants