From b973ed764b52e750d73f4b08aaf1749f8b608b39 Mon Sep 17 00:00:00 2001 From: Akshay Patidar Date: Fri, 29 Dec 2023 14:08:20 +0530 Subject: [PATCH 1/4] fix: update go version (#212) Signed-off-by: Akshay Patidar --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f021bc8b..ac9feb44 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,9 +25,9 @@ jobs: version: ${{ steps.commit.outputs.version }} message: ${{ steps.commit.outputs.version }} token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v4 with: - go-version: '1.17.1' + go-version: "1.20.2" - name: Create Release Asset run: | make compressed-builds From 6dadccd2e2a6b2487d0bc759e780d7bb6aa5c4ad Mon Sep 17 00:00:00 2001 From: Susanth <110461367+boppanasusanth@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:13:26 +0530 Subject: [PATCH 2/4] no hyphen at the end of env name (#216) --- app/app.go | 2 +- internal/command/commands/env.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index f3e0a569..69fde420 100644 --- a/app/app.go +++ b/app/app.go @@ -8,5 +8,5 @@ type application struct { // App (Application) interface var App application = application{ Name: "odin", - Version: "1.3.2", + Version: "1.3.3", } diff --git a/internal/command/commands/env.go b/internal/command/commands/env.go index b273a922..2f7ac2f0 100644 --- a/internal/command/commands/env.go +++ b/internal/command/commands/env.go @@ -63,8 +63,8 @@ func (e *Env) Run(args []string) int { e.Logger.Error("Env Name should not be of length more than 9") return 1 } - if (utils.SearchString(*name, "^[a-z][a-z0-9-]*$")) == "nil" { - e.Logger.Error("Env name only allows lower case alphabets, numbers and '-'. And should start with an alphabet.") + if (utils.SearchString(*name, "^[a-z]([a-z0-9-]*[a-z0-9])?$")) == "nil" { + e.Logger.Error("Env name only allows lower case alphabets, numbers and '-'. Should start with an alphabet and not end with a hyphen.") return 1 } envConfig := environment.Env{ From bb1493a4f9a570601bf7c98f95522ab9592ddd81 Mon Sep 17 00:00:00 2001 From: Akshay Patidar Date: Wed, 20 Mar 2024 18:51:00 +0530 Subject: [PATCH 3/4] fix: make options optional (#218) Signed-off-by: Akshay Patidar --- .github/workflows/go-lint.yaml | 4 ++-- internal/command/commands/component.go | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/go-lint.yaml b/.github/workflows/go-lint.yaml index a3e69c44..4963a961 100644 --- a/.github/workflows/go-lint.yaml +++ b/.github/workflows/go-lint.yaml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: - version: v1.51.1 + version: v1.54 args: -E gofmt -E gci diff --git a/internal/command/commands/component.go b/internal/command/commands/component.go index fa6febef..4e63a254 100644 --- a/internal/command/commands/component.go +++ b/internal/command/commands/component.go @@ -25,7 +25,7 @@ func (c *Component) Run(args []string) int { serviceName := flagSet.String("service", "", "name of the service in which the component is deployed") envName := flagSet.String("env", "", "name of the environment in which the service is deployed") operation := flagSet.String("operation", "", "name of the operation to performed on the component") - options := flagSet.String("options", "", "options of the operation in JSON format") + options := flagSet.String("options", "{}", "options of the operation in JSON format") filePath := flagSet.String("file", "", "file to provide options for component operations") err := flagSet.Parse(args) @@ -40,7 +40,7 @@ func (c *Component) Run(args []string) int { } emptyParameters := emptyParameters(map[string]string{"--name": *name, "--service": *serviceName, "--env": *envName, "--operation": *operation}) if len(emptyParameters) == 0 { - isOptionsPresent := len(*options) > 0 + isOptionsPresent := *options != "{}" isFilePresent := len(*filePath) > 0 if isOptionsPresent && isFilePresent { @@ -48,11 +48,6 @@ func (c *Component) Run(args []string) int { return 1 } - if !isOptionsPresent && !isFilePresent { - c.Logger.Error("You should provide either --options or --file") - return 1 - } - var optionsData map[string]interface{} if isFilePresent { @@ -62,7 +57,7 @@ func (c *Component) Run(args []string) int { return 1 } optionsData = parsedConfig.(map[string]interface{}) - } else if isOptionsPresent { + } else { err = json.Unmarshal([]byte(*options), &optionsData) if err != nil { c.Logger.Error("Unable to parse JSON data " + err.Error()) From 9a6ffd04504661c702211fefec051d0d000e465f Mon Sep 17 00:00:00 2001 From: Akshay Patidar Date: Wed, 20 Mar 2024 19:39:04 +0530 Subject: [PATCH 4/4] fix: cgo disabled when building go binaries (#220) Signed-off-by: Akshay Patidar --- Makefile | 6 +++--- app/app.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 53b8816b..56e77b97 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,11 @@ lint: build: go mod download mkdir -p bin/odin_darwin_amd64 - env GOOS=darwin GOARCH=amd64 go build -o bin/odin_darwin_amd64/odin + env GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o bin/odin_darwin_amd64/odin mkdir -p bin/odin_darwin_arm64 - env GOOS=darwin GOARCH=arm64 go build -o bin/odin_darwin_arm64/odin + env GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o bin/odin_darwin_arm64/odin mkdir -p bin/odin_linux_amd64 - env GOOS=linux GOARCH=amd64 go build -o bin/odin_linux_amd64/odin + env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/odin_linux_amd64/odin compressed-builds: build cd bin/odin_darwin_amd64 && tar -czvf ../odin_darwin_amd64.tar.gz odin diff --git a/app/app.go b/app/app.go index 69fde420..263406f2 100644 --- a/app/app.go +++ b/app/app.go @@ -8,5 +8,5 @@ type application struct { // App (Application) interface var App application = application{ Name: "odin", - Version: "1.3.3", + Version: "1.3.4", }