Skip to content

Commit

Permalink
Updated to go1.23 (#3096)
Browse files Browse the repository at this point in the history
* Updated to go1.23

* Updated the go-version-file to have qoutes

* Updated the gravitl/go-builder to 1.23

* versioned tag in Dockerfile

* update go-builder workflow
  • Loading branch information
lmnzx authored Sep 9, 2024
1 parent db4cf1d commit 3d7569b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/docker-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ name: Build go-builder images

on:
workflow_dispatch:
push:
branches:
- 'develop'

inputs:
docker_tag:
description: 'Docker tag to use (default: latest)'
required: false
default: 'latest'
jobs:
go-builder:
runs-on: ubuntu-latest
Expand All @@ -26,4 +27,4 @@ jobs:
push: true
platforms: linux/amd64, linux/arm64, linux/arm/v7
file: ./docker/Dockerfile-go-builder
tags: gravitl/go-builder:latest
tags: gravitl/go-builder:${{ github.event.inputs.docker_tag || 'latest' }}
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: 'go.mod'
- name: Build
run: |
env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build main.go
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: 'go.mod'
- name: Build
run: |
cd cli
Expand All @@ -46,7 +46,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: 'go.mod'
- name: run tests
run: |
go vet ./...
Expand All @@ -66,9 +66,9 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: 'go.mod'
- name: run static checks
run: |
sudo apt update
go install honnef.co/go/tools/cmd/staticcheck@v0.4.7
go install honnef.co/go/tools/cmd/staticcheck@latest
{ ~/go/bin/staticcheck -tags=ee ./... ; }
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#first stage - builder
FROM gravitl/go-builder AS builder
FROM gravitl/go-builder:1.23.0 AS builder
ARG tags
WORKDIR /app
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-go-builder
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.13-alpine3.19
FROM golang:1.23.0-alpine3.20
ARG version
RUN apk add build-base
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gravitl/netmaker

go 1.19
go 1.23

require (
github.com/eclipse/paho.mqtt.golang v1.4.3
Expand Down
4 changes: 2 additions & 2 deletions models/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ var logoString = retrieveLogo()

// GenerateNodeName - generates a random node name
func GenerateNodeName() string {
rand.Seed(time.Now().UnixNano())
return SMALL_NAMES[rand.Intn(len(SMALL_NAMES))] + "-" + NAMES[seededRand.Intn(len(NAMES))]
rng := rand.New(rand.NewSource(time.Now().UnixNano()))
return SMALL_NAMES[rng.Intn(len(SMALL_NAMES))] + "-" + NAMES[rng.Intn(len(NAMES))]
}

// RetrieveLogo - retrieves the ascii art logo for Netmaker
Expand Down
12 changes: 6 additions & 6 deletions pro/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package pro

import (
"fmt"
"errors"
)

// constants for accounts api hosts
Expand All @@ -23,7 +23,7 @@ const (
server_id_key = "nm-server-id"
)

var errValidation = fmt.Errorf(license_validation_err_msg)
var errValidation = errors.New(license_validation_err_msg)

// LicenseKey - the license key struct representation with associated data
type LicenseKey struct {
Expand All @@ -42,14 +42,14 @@ type LicenseKey struct {

// ValidatedLicense - the validated license struct
type ValidatedLicense struct {
LicenseValue string `json:"license_value" binding:"required"` // license that validation is being requested for
LicenseValue string `json:"license_value" binding:"required"` // license that validation is being requested for
EncryptedLicense string `json:"encrypted_license" binding:"required"` // to be decrypted by Netmaker using Netmaker server's private key
}

// LicenseSecret - the encrypted struct for sending user-id
type LicenseSecret struct {
AssociatedID string `json:"associated_id" binding:"required"` // UUID for user foreign key to User table
Usage Usage `json:"limits" binding:"required"`
Usage Usage `json:"limits" binding:"required"`
}

// Usage - struct for license usage
Expand Down Expand Up @@ -81,9 +81,9 @@ func (l *Usage) SetDefaults() {

// ValidateLicenseRequest - used for request to validate license endpoint
type ValidateLicenseRequest struct {
LicenseKey string `json:"license_key" binding:"required"`
LicenseKey string `json:"license_key" binding:"required"`
NmServerPubKey string `json:"nm_server_pub_key" binding:"required"` // Netmaker server public key used to send data back to Netmaker for the Netmaker server to decrypt (eg output from validating license)
EncryptedPart string `json:"secret" binding:"required"`
EncryptedPart string `json:"secret" binding:"required"`
}

type licenseResponseCache struct {
Expand Down

0 comments on commit 3d7569b

Please sign in to comment.