Skip to content
Snippets Groups Projects
Commit 1d275819 authored by Andre Sterba's avatar Andre Sterba Committed by Malte Bauch
Browse files

Update to go 1.19

See merge request !365
parent c3b18c47
No related branches found
No related tags found
2 merge requests!365Update to go 1.19,!333WIP: Develop
Pipeline #111199 passed
Showing
with 48 additions and 48 deletions
......@@ -2,7 +2,7 @@ variables:
GOSDN_IMAGE: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}"
GOSDN_TESTING_IMAGE: "${CI_REGISTRY_IMAGE}:testing_${CI_COMMIT_SHA}"
CEOS_IMAGE: "${CI_PCONTAINERS_REGISTRY_IMAGE}/ceos:4.28.0F"
GOLANG_VERSION: "1.18"
GOLANG_VERSION: "1.19"
workflow:
rules:
......
run:
go: 1.18
go: 1.19
concurrency: 4
timeout: 10m
issues-exit-code: 1
......
test:
image: golang:1.18
image: golang:1.19
stage: test
needs:
- job: "apply"
......@@ -22,7 +22,7 @@ test:
- go test -race ./test/integration -v -coverprofile=coverage.out
.test: &test
image: golang:1.18
image: golang:1.19
stage: test
allow_failure: true
variables:
......
ARG GOLANG_VERSION=1.18
ARG GOLANG_VERSION=1.19
ARG BUILDARGS
ARG $GITLAB_PROXY
......
......@@ -38,8 +38,8 @@ import (
"github.com/spf13/viper"
)
//TODO: this requires us to make getDevices in grpc.go of gosdn public and we
//also need to implement GetSBI()
// TODO: this requires us to make getDevices in grpc.go of gosdn public and we
// also need to implement GetSBI()
// pndCmd represents the pnd command.
var listCmd = &cobra.Command{
Use: "list",
......
......@@ -5,16 +5,16 @@ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
......
......@@ -24,7 +24,7 @@ func GetSbi(ctx context.Context, addr string, pid string, sid string) (*ppb.GetS
return client.GetSbi(ctx, req)
}
//GetSBIs requests all to the provided PND belonging SBIs from the controller.
// GetSBIs requests all to the provided PND belonging SBIs from the controller.
func GetSBIs(ctx context.Context, addr string, pid string) (*ppb.GetSbiListResponse, error) {
client, err := nbi.PndClient(addr, dialOptions...)
if err != nil {
......
......@@ -25,7 +25,7 @@ func CreateUsers(ctx context.Context, addr string, users []*apb.User) (*apb.Crea
return userClient.CreateUsers(ctx, r)
}
//GetUser returns one requested user found by name.
// GetUser returns one requested user found by name.
func GetUser(ctx context.Context, addr, name string, uuid uuid.UUID) (*apb.GetUserResponse, error) {
userClient, err := nbi.UserClient(addr, dialOptions...)
if err != nil {
......
......@@ -5,16 +5,16 @@ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
......
ARG GOLANG_VERSION=1.18
ARG GOLANG_VERSION=1.19
ARG BUILDARGS
ARG $GITLAB_PROXY
......
......@@ -2,7 +2,7 @@ package plugin
import (
"fmt"
"io/ioutil"
"os"
"regexp"
"code.fbi.h-da.de/danet/gosdn/controller/customerrs"
......@@ -88,7 +88,7 @@ func (m *Manifest) Validate() error {
func ReadManifestFromFile(path string) (*Manifest, error) {
manifest := &Manifest{}
manifestFile, err := ioutil.ReadFile(path)
manifestFile, err := os.ReadFile(path)
if err != nil {
return nil, err
}
......
......@@ -2,7 +2,7 @@ package nucleus
import (
"encoding/json"
"io/ioutil"
"os"
"sync"
"code.fbi.h-da.de/danet/gosdn/controller/customerrs"
......@@ -36,7 +36,7 @@ func NewFilesystemDeviceStore(pndUUID uuid.UUID) device.Store {
func (s *FilesystemDeviceStore) readAllDevicesFromFile() ([]device.LoadedDevice, error) {
var loadedDevices []device.LoadedDevice
content, err := ioutil.ReadFile(s.pathToDeviceFile)
content, err := os.ReadFile(s.pathToDeviceFile)
if err != nil {
return nil, err
}
......@@ -55,7 +55,7 @@ func (s *FilesystemDeviceStore) writeAllDevicesToFile(devices []device.LoadedDev
return err
}
err = ioutil.WriteFile(s.pathToDeviceFile, serializedData, 0600)
err = os.WriteFile(s.pathToDeviceFile, serializedData, 0600)
if err != nil {
return err
}
......
......@@ -195,7 +195,7 @@ func createSetRequest(ctx context.Context, diff *gpb.Notification, json []byte,
return req, nil
}
//Subscribe subscribes to a gNMI target.
// Subscribe subscribes to a gNMI target.
func (g *Gnmi) Subscribe(ctx context.Context, params ...string) error {
if g.client == nil {
return &customerrs.NilClientError{}
......
......@@ -3,7 +3,6 @@ package nucleus
import (
"context"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"testing"
......@@ -185,7 +184,7 @@ func removeTestPlugins() {
var seconds int64 = 10
// get all available files
dirs, err := ioutil.ReadDir(currentDirectory)
dirs, err := os.ReadDir(currentDirectory)
if err != nil {
log.Info(err)
}
......
......@@ -2,7 +2,7 @@ package nucleus
import (
"encoding/json"
"io/ioutil"
"os"
"sync"
cpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi"
......@@ -41,7 +41,7 @@ func NewFilesystemPndStore() FilesystemPndStore {
func (t *FilesystemPndStore) readAllPndsFromFile() ([]networkdomain.NetworkDomain, error) {
var loadedPnds []LoadedPnd
content, err := ioutil.ReadFile(t.pathToPndFile)
content, err := os.ReadFile(t.pathToPndFile)
if err != nil {
return nil, err
}
......@@ -81,7 +81,7 @@ func (t *FilesystemPndStore) writeAllPndsToFile(pnds []networkdomain.NetworkDoma
return err
}
err = ioutil.WriteFile(t.pathToPndFile, serializedData, 0600)
err = os.WriteFile(t.pathToPndFile, serializedData, 0600)
if err != nil {
return err
}
......
......@@ -495,9 +495,10 @@ func (pnd *pndImplementation) ensureIntendedConfigurationIsAppliedOnDevice(devic
return nil
}
//nolint:gocyclo
// ChangeOND creates a change from the provided Operation, path and value.
// The Change is Pending and times out after the specified timeout period.
//
// nolint:gocyclo
func (pnd *pndImplementation) ChangeOND(duid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (uuid.UUID, error) {
//TODO: check if we can get cyclomatic complexity from 16 to at least 15
d, err := pnd.deviceService.Get(store.Query{
......@@ -638,7 +639,7 @@ func mapModeToAristaFork(mode ppb.SubscriptionMode) (string, error) {
}
}
//nolint
// nolint
// handleRollbackError will be implemented in the near future
func handleRollbackError(id uuid.UUID, err error) {
log.Error(err)
......
......@@ -2,7 +2,7 @@ package nucleus
import (
"encoding/json"
"io/ioutil"
"os"
"sync"
"code.fbi.h-da.de/danet/gosdn/controller/customerrs"
......@@ -38,7 +38,7 @@ func NewFilesystemSbiStore(pndUUID uuid.UUID) southbound.Store {
func (s *FilesystemSbiStore) readAllSbisFromFile() ([]southbound.LoadedSbi, error) {
var loadedSbis []southbound.LoadedSbi
content, err := ioutil.ReadFile(s.pathToSbiFile)
content, err := os.ReadFile(s.pathToSbiFile)
if err != nil {
return nil, err
}
......@@ -56,7 +56,7 @@ func (s *FilesystemSbiStore) writeAllSbisToFile(sbis []southbound.LoadedSbi) err
return err
}
err = ioutil.WriteFile(s.pathToSbiFile, serializedData, 0600)
err = os.WriteFile(s.pathToSbiFile, serializedData, 0600)
if err != nil {
return err
}
......
......@@ -122,7 +122,7 @@ func (oc *OpenConfig) Unmarshal(bytes []byte, path *gpb.Path, goStruct ygot.GoSt
return unmarshal(oc.Schema(), bytes, path, goStruct, opt...)
}
//unmarshal parses a gNMI response to a go struct.
// unmarshal parses a gNMI response to a go struct.
func unmarshal(schema *ytypes.Schema, bytes []byte, path *gpb.Path, goStruct ygot.GoStruct, opt ...ytypes.UnmarshalOpt) error {
defer func() {
if r := recover(); r != nil {
......
......@@ -9,8 +9,8 @@ import (
"github.com/openconfig/goyang/pkg/yang"
)
//ConvertStringToGnmiTypedValue allows to convert a string into a
//gnmi.TypedValue; this conversion is based on the provided YANG type.
// ConvertStringToGnmiTypedValue allows to convert a string into a
// gnmi.TypedValue; this conversion is based on the provided YANG type.
func ConvertStringToGnmiTypedValue(s string, t *yang.YangType) (*gnmi.TypedValue, error) {
// TODO: add more types
switch t.Kind {
......
......@@ -2,7 +2,7 @@ package proto
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"google.golang.org/protobuf/proto"
......@@ -19,7 +19,7 @@ func Write(message proto.Message, filename string) error {
return fmt.Errorf("cannot marshal proto message to binary: %w", err)
}
err = ioutil.WriteFile(filename, data, 0600)
err = os.WriteFile(filename, data, 0600)
if err != nil {
return fmt.Errorf("cannot write binary data to file: %w", err)
}
......@@ -30,7 +30,7 @@ func Write(message proto.Message, filename string) error {
// Read reads a binary file (containing a marshaled protocol buffer message)
// and unmarshals it back into a protocol buffer message.
func Read(filename string, message proto.Message) error {
data, err := ioutil.ReadFile(filepath.Clean(filename))
data, err := os.ReadFile(filepath.Clean(filename))
if err != nil {
return fmt.Errorf("cannot read binary data from file: %w", err)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment