mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-04 10:54:24 +08:00
Updated to go1.23 (#3096)
* 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
This commit is contained in:
parent
db4cf1d1fd
commit
3d7569b22b
7 changed files with 22 additions and 21 deletions
11
.github/workflows/docker-builder.yml
vendored
11
.github/workflows/docker-builder.yml
vendored
|
@ -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
|
||||
|
@ -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
.github/workflows/test.yml
vendored
10
.github/workflows/test.yml
vendored
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 ./...
|
||||
|
@ -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 ./... ; }
|
||||
|
|
|
@ -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 . .
|
||||
|
|
|
@ -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
|
||||
|
|
2
go.mod
2
go.mod
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
12
pro/types.go
12
pro/types.go
|
@ -4,7 +4,7 @@
|
|||
package pro
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// constants for accounts api hosts
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue