spotless icon indicating copy to clipboard operation
spotless copied to clipboard

Better shfmt CLI path lookup

Open Goooler opened this issue 1 year ago • 3 comments

If I install shfmt via Go following the official instruction, it cannot be detected by Spotless automatically, may need to handle this case. See

  • https://github.com/Goooler/spotless/commit/c0e8f25c554ad8c440ecee35f9d0c18aa18622ac
  • https://scans.gradle.com/s/qma775ajcerbc/tests/overview?outcome=FAILED

Goooler avatar Feb 06 '24 02:02 Goooler

Based on what I see on macOS, shfmt is not immediately made accessible on the PATH. For mac, I would have to add ~/go/bin to my PATH in order to get this to work since that's where go installs binaries on mac. I'm sure something similar is necessary for ubuntu and that the ubuntu github runners don't have the go bin path on the PATH by default.

tbcrawford avatar Feb 07 '24 01:02 tbcrawford

Yeah, $GOPATH/bin hasn't been added to path, I filed it to https://github.com/actions/runner-images/issues/9316.

But the issue still exists, I installed it via apt, cannot be detected as well, see https://github.com/Goooler/spotless/actions/runs/7827663325/job/21356021181

Goooler avatar Feb 08 '24 10:02 Goooler

That's interesting that apt didn't work for you. Did you specifically use apt or apt-get? One of the reasons I decided not to use apt or apt-get was that it installs an older version of shfmt: 3.6.0. The latest is 3.7.0.

In the issue that you filed it seems like the recommendation is to use https://github.com/actions/setup-go. I wonder if that's the preferred route we should take here instead of installing shfmt from the published github release.

tbcrawford avatar Feb 08 '24 14:02 tbcrawford