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
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"code.fbi.h-da.de/danet/gosdn/controller/store" "code.fbi.h-da.de/danet/gosdn/controller/store"
) )
//MemoryRoleStore provides a in-memory implementation for roles. // MemoryRoleStore provides a in-memory implementation for roles.
type MemoryRoleStore struct { type MemoryRoleStore struct {
Store map[string]rbac.LoadedRole Store map[string]rbac.LoadedRole
nameLookupTable map[string]string nameLookupTable map[string]string
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"code.fbi.h-da.de/danet/gosdn/controller/store" "code.fbi.h-da.de/danet/gosdn/controller/store"
) )
//MemoryUserStore provides a in-memory implementation for users. // MemoryUserStore provides a in-memory implementation for users.
type MemoryUserStore struct { type MemoryUserStore struct {
Store map[string]rbac.LoadedUser Store map[string]rbac.LoadedUser
nameLookupTable map[string]string nameLookupTable map[string]string
......
...@@ -2,7 +2,7 @@ package rbac ...@@ -2,7 +2,7 @@ package rbac
import ( import (
"encoding/json" "encoding/json"
"io/ioutil" "os"
"sync" "sync"
"code.fbi.h-da.de/danet/gosdn/controller/customerrs" "code.fbi.h-da.de/danet/gosdn/controller/customerrs"
...@@ -31,7 +31,7 @@ func NewFileSystemRoleStore() rbac.RoleStore { ...@@ -31,7 +31,7 @@ func NewFileSystemRoleStore() rbac.RoleStore {
func (s *FileSystemRoleStore) readAllRolesFromFile() ([]rbac.LoadedRole, error) { func (s *FileSystemRoleStore) readAllRolesFromFile() ([]rbac.LoadedRole, error) {
var loadedRoles []rbac.LoadedRole var loadedRoles []rbac.LoadedRole
content, err := ioutil.ReadFile(s.pathToRoleFile) content, err := os.ReadFile(s.pathToRoleFile)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -50,7 +50,7 @@ func (s *FileSystemRoleStore) writeAllRolesToFile(roles []rbac.LoadedRole) error ...@@ -50,7 +50,7 @@ func (s *FileSystemRoleStore) writeAllRolesToFile(roles []rbac.LoadedRole) error
return err return err
} }
err = ioutil.WriteFile(s.pathToRoleFile, serializedData, 0600) err = os.WriteFile(s.pathToRoleFile, serializedData, 0600)
if err != nil { if err != nil {
return err return err
} }
...@@ -84,7 +84,7 @@ func (s *FileSystemRoleStore) Add(roleToAdd rbac.Role) error { ...@@ -84,7 +84,7 @@ func (s *FileSystemRoleStore) Add(roleToAdd rbac.Role) error {
return nil return nil
} }
//Delete deletes a Role from the Role store. // Delete deletes a Role from the Role store.
func (s *FileSystemRoleStore) Delete(roleToDelete rbac.Role) error { func (s *FileSystemRoleStore) Delete(roleToDelete rbac.Role) error {
s.fileMutex.Lock() s.fileMutex.Lock()
defer s.fileMutex.Unlock() defer s.fileMutex.Unlock()
...@@ -112,7 +112,7 @@ func (s *FileSystemRoleStore) Delete(roleToDelete rbac.Role) error { ...@@ -112,7 +112,7 @@ func (s *FileSystemRoleStore) Delete(roleToDelete rbac.Role) error {
return &customerrs.CouldNotDeleteError{Identifier: roleToDelete.ID(), Type: roleToDelete, Err: err} return &customerrs.CouldNotDeleteError{Identifier: roleToDelete.ID(), Type: roleToDelete, Err: err}
} }
//Get takes a Roles ID and return the Role if found. // Get takes a Roles ID and return the Role if found.
func (s *FileSystemRoleStore) Get(query store.Query) (rbac.LoadedRole, error) { func (s *FileSystemRoleStore) Get(query store.Query) (rbac.LoadedRole, error) {
s.fileMutex.Lock() s.fileMutex.Lock()
defer s.fileMutex.Unlock() defer s.fileMutex.Unlock()
...@@ -141,7 +141,7 @@ func (s *FileSystemRoleStore) GetAll() ([]rbac.LoadedRole, error) { ...@@ -141,7 +141,7 @@ func (s *FileSystemRoleStore) GetAll() ([]rbac.LoadedRole, error) {
return Roles, err return Roles, err
} }
//Update updates an exsisting Role. // Update updates an exsisting Role.
func (s *FileSystemRoleStore) Update(roleToUpdate rbac.Role) error { func (s *FileSystemRoleStore) Update(roleToUpdate rbac.Role) error {
s.fileMutex.Lock() s.fileMutex.Lock()
defer s.fileMutex.Unlock() defer s.fileMutex.Unlock()
......
...@@ -2,7 +2,7 @@ package rbac ...@@ -2,7 +2,7 @@ package rbac
import ( import (
"encoding/json" "encoding/json"
"io/ioutil" "os"
"sync" "sync"
"code.fbi.h-da.de/danet/gosdn/controller/customerrs" "code.fbi.h-da.de/danet/gosdn/controller/customerrs"
...@@ -31,7 +31,7 @@ func NewFileSystemUserStore() rbac.UserStore { ...@@ -31,7 +31,7 @@ func NewFileSystemUserStore() rbac.UserStore {
func (s *FileSystemUserStore) readAllUsersFromFile() ([]rbac.LoadedUser, error) { func (s *FileSystemUserStore) readAllUsersFromFile() ([]rbac.LoadedUser, error) {
var loadedUsers []rbac.LoadedUser var loadedUsers []rbac.LoadedUser
content, err := ioutil.ReadFile(s.pathToUserFile) content, err := os.ReadFile(s.pathToUserFile)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -50,7 +50,7 @@ func (s *FileSystemUserStore) writeAllUsersToFile(users []rbac.LoadedUser) error ...@@ -50,7 +50,7 @@ func (s *FileSystemUserStore) writeAllUsersToFile(users []rbac.LoadedUser) error
return err return err
} }
err = ioutil.WriteFile(s.pathToUserFile, serializedData, 0600) err = os.WriteFile(s.pathToUserFile, serializedData, 0600)
if err != nil { if err != nil {
return err return err
} }
...@@ -84,7 +84,7 @@ func (s *FileSystemUserStore) Add(UserToAdd rbac.User) error { ...@@ -84,7 +84,7 @@ func (s *FileSystemUserStore) Add(UserToAdd rbac.User) error {
return nil return nil
} }
//Delete deletes a User from the User store. // Delete deletes a User from the User store.
func (s *FileSystemUserStore) Delete(userToDelete rbac.User) error { func (s *FileSystemUserStore) Delete(userToDelete rbac.User) error {
s.fileMutex.Lock() s.fileMutex.Lock()
defer s.fileMutex.Unlock() defer s.fileMutex.Unlock()
...@@ -112,7 +112,7 @@ func (s *FileSystemUserStore) Delete(userToDelete rbac.User) error { ...@@ -112,7 +112,7 @@ func (s *FileSystemUserStore) Delete(userToDelete rbac.User) error {
return &customerrs.CouldNotDeleteError{Identifier: userToDelete.ID(), Type: userToDelete, Err: err} return &customerrs.CouldNotDeleteError{Identifier: userToDelete.ID(), Type: userToDelete, Err: err}
} }
//Get takes a Users ID and return the User if found. // Get takes a Users ID and return the User if found.
func (s *FileSystemUserStore) Get(query store.Query) (rbac.LoadedUser, error) { func (s *FileSystemUserStore) Get(query store.Query) (rbac.LoadedUser, error) {
s.fileMutex.Lock() s.fileMutex.Lock()
defer s.fileMutex.Unlock() defer s.fileMutex.Unlock()
...@@ -141,7 +141,7 @@ func (s *FileSystemUserStore) GetAll() ([]rbac.LoadedUser, error) { ...@@ -141,7 +141,7 @@ func (s *FileSystemUserStore) GetAll() ([]rbac.LoadedUser, error) {
return Users, err return Users, err
} }
//Update updates an exsisting user. // Update updates an exsisting user.
func (s *FileSystemUserStore) Update(userToUpdate rbac.User) error { func (s *FileSystemUserStore) Update(userToUpdate rbac.User) error {
s.fileMutex.Lock() s.fileMutex.Lock()
defer s.fileMutex.Unlock() defer s.fileMutex.Unlock()
......
...@@ -27,7 +27,7 @@ func FromString(id string) (uuid.UUID, error) { ...@@ -27,7 +27,7 @@ func FromString(id string) (uuid.UUID, error) {
return idAsUUID, nil return idAsUUID, nil
} }
//EnsureFilesystemStorePathExists ensures that the filesystem store path exists. // EnsureFilesystemStorePathExists ensures that the filesystem store path exists.
func EnsureFilesystemStorePathExists(storeFileName string) error { func EnsureFilesystemStorePathExists(storeFileName string) error {
completeStorePath := filepath.Join(config.FilesystemPathToStores, storeFileName) completeStorePath := filepath.Join(config.FilesystemPathToStores, storeFileName)
if _, err := os.Stat(completeStorePath); os.IsNotExist(err) { if _, err := os.Stat(completeStorePath); os.IsNotExist(err) {
...@@ -67,12 +67,12 @@ func ensureDirExists(fileName string) error { ...@@ -67,12 +67,12 @@ func ensureDirExists(fileName string) error {
return nil return nil
} }
//GetCompletePathToFileStore gets the complete path to a file store. // GetCompletePathToFileStore gets the complete path to a file store.
func GetCompletePathToFileStore(storeName string) string { func GetCompletePathToFileStore(storeName string) string {
return filepath.Join(config.FilesystemPathToStores, storeName) return filepath.Join(config.FilesystemPathToStores, storeName)
} }
//TransformObjectToLoadedObject transform an object into an loadedObject. // TransformObjectToLoadedObject transform an object into an loadedObject.
func TransformObjectToLoadedObject[T, R any](object T) (R, error) { func TransformObjectToLoadedObject[T, R any](object T) (R, error) {
var loadedObject R var loadedObject R
...@@ -89,7 +89,7 @@ func TransformObjectToLoadedObject[T, R any](object T) (R, error) { ...@@ -89,7 +89,7 @@ func TransformObjectToLoadedObject[T, R any](object T) (R, error) {
return loadedObject, err return loadedObject, err
} }
//GetStoreFilenameForUUID returns the full filename for a given pndUUID and suffix. // GetStoreFilenameForUUID returns the full filename for a given pndUUID and suffix.
func GetStoreFilenameForUUID(pndUUID uuid.UUID, deviceFilenameSuffix string) string { func GetStoreFilenameForUUID(pndUUID uuid.UUID, deviceFilenameSuffix string) string {
return pndUUID.String() + "-" + deviceFilenameSuffix return pndUUID.String() + "-" + deviceFilenameSuffix
} }
...@@ -5,16 +5,16 @@ All rights reserved. ...@@ -5,16 +5,16 @@ All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, 1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, 2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors 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 may be used to endorse or promote products derived from this software
without specific prior written permission. without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 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 BUILDARGS
ARG $GITLAB_PROXY ARG $GITLAB_PROXY
......
FROM golang:1.18-alpine FROM golang:1.19-alpine
RUN go install github.com/google/gnxi/gnmi_target@latest RUN go install github.com/google/gnxi/gnmi_target@latest
RUN wget https://raw.githubusercontent.com/google/gnxi/master/gnmi_target/openconfig-openflow.json RUN wget https://raw.githubusercontent.com/google/gnxi/master/gnmi_target/openconfig-openflow.json
EXPOSE 7030 EXPOSE 7030
......
# syntax = docker/dockerfile:1.2 # syntax = docker/dockerfile:1.2
FROM golang:1.18-alpine AS installer FROM golang:1.19-alpine AS installer
ARG GITLAB_USER ARG GITLAB_USER
ARG GITLAB_TOKEN ARG GITLAB_TOKEN
WORKDIR /src/csbi WORKDIR /src/csbi
......
module code.fbi.h-da.de/danet/gosdn/csbi-autogen module code.fbi.h-da.de/danet/gosdn/csbi-autogen
go 1.18 go 1.19
require ( require (
code.fbi.h-da.de/danet/gosdn v0.0.3-0.20220805102430-8465989fb8b3 code.fbi.h-da.de/danet/gosdn v0.0.3-0.20220805102430-8465989fb8b3
......
...@@ -5,7 +5,6 @@ import ( ...@@ -5,7 +5,6 @@ import (
"context" "context"
"fmt" "fmt"
"io/fs" "io/fs"
"io/ioutil"
"net" "net"
"os" "os"
"os/exec" "os/exec"
...@@ -226,7 +225,7 @@ func writeManifest(path string, manifest *Manifest) error { ...@@ -226,7 +225,7 @@ func writeManifest(path string, manifest *Manifest) error {
if err != nil { if err != nil {
return err return err
} }
if err := ioutil.WriteFile(filepath.Join(path, manifestFileName), m, 0644); err != nil { if err := os.WriteFile(filepath.Join(path, manifestFileName), m, 0644); err != nil {
return err return err
} }
return nil return nil
......
module code.fbi.h-da.de/danet/gosdn module code.fbi.h-da.de/danet/gosdn
go 1.18 go 1.19
require ( require (
github.com/aristanetworks/goarista v0.0.0-20220425175323-05f7c4c5e34c github.com/aristanetworks/goarista v0.0.0-20220425175323-05f7c4c5e34c
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment