summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2022-03-25 12:31:02 +0100
committerValery Piashchynski <[email protected]>2022-03-25 12:32:46 +0100
commit2c8b5fdfda79a2192ecb099e0b11bc0ba0620129 (patch)
treeb70ee51068c5d873f5665eb5c54fc97e9e61710b
parentde7b748278b9b626aa1dcf608b916a2b4e342f9b (diff)
[#1075]: chore(work_dir): change wd before searching for the config
-rw-r--r--.github/workflows/tests.yml2
-rwxr-xr-x.golangci.yml1
-rw-r--r--internal/cli/root.go12
3 files changed, 8 insertions, 7 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 940092e4..9b4c4f6c 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -45,7 +45,7 @@ jobs:
- name: Run linter
uses: golangci/[email protected]
with:
- version: v1.44 # without patch version
+ version: v1.45.1 # without patch version
only-new-issues: false # show only new issues if it's a pull request
args: --build-tags=safe --timeout=10m
diff --git a/.golangci.yml b/.golangci.yml
index cde73399..888f3478 100755
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,6 +1,7 @@
# Documentation: <https://github.com/golangci/golangci-lint#config-file>
run:
+ go: '1.17'
timeout: 1m
skip-dirs:
- .github
diff --git a/internal/cli/root.go b/internal/cli/root.go
index f71368f1..7e22124a 100644
--- a/internal/cli/root.go
+++ b/internal/cli/root.go
@@ -46,6 +46,12 @@ func NewCommand(cmdName string) *cobra.Command { //nolint:funlen
return errors.Str("no configuration file provided")
}
+ if workDir != "" {
+ if err := os.Chdir(workDir); err != nil {
+ return err
+ }
+ }
+
if absPath, err := filepath.Abs(*cfgFile); err == nil {
*cfgFile = absPath // switch config path to the absolute
@@ -55,12 +61,6 @@ func NewCommand(cmdName string) *cobra.Command { //nolint:funlen
}
}
- if workDir != "" {
- if err := os.Chdir(workDir); err != nil {
- return err
- }
- }
-
if v, ok := os.LookupEnv(envDotenv); ok { // read path to the dotenv file from environment variable
dotenv = v
}