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

use err for lookpath #118

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN microdnf -y install git &&\
FROM quay.io/konveyor/static-report as static-report

# Build the manager binary
FROM golang:1.18 as builder
FROM golang:1.19 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
6 changes: 5 additions & 1 deletion cmd/settings.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"errors"
"os"
"os/exec"

Expand Down Expand Up @@ -28,7 +29,10 @@ type Config struct {
func (c *Config) Load() error {
envValue := os.Getenv("PODMAN_BIN")
if envValue == "" {
podmanPath, _ := exec.LookPath("podman")
podmanPath, err := exec.LookPath("podman")
if err != nil && errors.Is(err, exec.ErrDot) {
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea was to only error when you see a errors.Is(err, ErrDot)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pranavgaikwad Looks like exec.ErrDot requires go 1.19: https://pkg.go.dev/os/exec
We may need to update the Dockerfile too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, analyzer-lsp is using 19 as well

}
if podmanPath != c.PodmanBinary && (podmanPath != "" || len(podmanPath) > 0) {
os.Setenv("PODMAN_BIN", podmanPath)
}
Expand Down