update to go 1.19

UBI and the oldest support Fedora (37) now all have go 1.19, so we are
cleared to switch.

gofmt now reformats comments in certain cases, so that explains the formatting
changes in this commit.
See https://go.dev/doc/go1.19#go-doc

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2023-07-21 13:34:22 +02:00 committed by Ondřej Budai
parent 89274e538d
commit cac9327b44
14 changed files with 54 additions and 45 deletions

View file

@ -250,7 +250,7 @@ func TestError(t *testing.T) {
}
//This tests calling all the functions on a Blueprint with no Customizations
// This tests calling all the functions on a Blueprint with no Customizations
func TestNoCustomizationsInBlueprint(t *testing.T) {
TestBP := Blueprint{}
@ -271,7 +271,7 @@ func TestNoCustomizationsInBlueprint(t *testing.T) {
assert.Nil(t, nilNTPServers)
}
//This tests additional scenarios where GetPrimaryLocale() returns nil values
// This tests additional scenarios where GetPrimaryLocale() returns nil values
func TestNilGetPrimaryLocale(t *testing.T) {
//Case empty Customization
@ -299,7 +299,7 @@ func TestNilGetPrimaryLocale(t *testing.T) {
}
//This tests additional scenario where GetTimezoneSEtting() returns nil values
// This tests additional scenario where GetTimezoneSEtting() returns nil values
func TestNilGetTimezoneSettings(t *testing.T) {
TestCustomizationsEmpty := Customizations{}

View file

@ -86,7 +86,8 @@ func NewAPIResponse(body []byte) (*APIResponse, error) {
// apiError converts an API error 400 JSON to a status response
//
// The response body should alway be of the form:
// {"status": false, "errors": [{"id": ERROR_ID, "msg": ERROR_MESSAGE}, ...]}
//
// {"status": false, "errors": [{"id": ERROR_ID, "msg": ERROR_MESSAGE}, ...]}
func apiError(resp *http.Response) (*APIResponse, error) {
defer resp.Body.Close()

View file

@ -8,18 +8,19 @@
// not from other functions.
//
// NOTE: The compose fail/finish tests use fake composes so the following are not
// fully tested here:
//
// * image download
// * log download
// * logs archive download
// * cancel waiting compose
// * cancel running compose
// fully tested here:
//
// In addition osbuild-composer has not implemented:
// * image download
// * log download
// * logs archive download
// * cancel waiting compose
// * cancel running compose
//
// * compose/results
// * compose/metadata
// In addition osbuild-composer has not implemented:
//
// * compose/results
// * compose/metadata
package client
import (

View file

@ -55,7 +55,7 @@ func GetProjectsInfoV0(socket *http.Client, projNames string) ([]rpmmd.PackageIn
return list.Projects, nil, nil
}
//DepsolveProjectsV0 returns the dependencies of the names projects
// DepsolveProjectsV0 returns the dependencies of the names projects
func DepsolveProjectsV0(socket *http.Client, projNames string) ([]rpmmd.PackageSpec, *APIResponse, error) {
body, resp, err := GetRaw(socket, "GET", "/api/v0/projects/depsolve/"+projNames)
if resp != nil || err != nil {

View file

@ -28,7 +28,7 @@ const (
// The ObjectAttrs is returned if the object has been created.
//
// Uses:
// - Storage API
// - Storage API
func (g *GCP) StorageObjectUpload(ctx context.Context, filename, bucket, object string, metadata map[string]string) (*storage.ObjectAttrs, error) {
storageClient, err := storage.NewClient(ctx, option.WithCredentials(g.creds))
if err != nil {
@ -82,7 +82,7 @@ func (g *GCP) StorageObjectUpload(ctx context.Context, filename, bucket, object
// StorageObjectDelete deletes the given object from a bucket.
//
// Uses:
// - Storage API
// - Storage API
func (g *GCP) StorageObjectDelete(ctx context.Context, bucket, object string) error {
storageClient, err := storage.NewClient(ctx, option.WithCredentials(g.creds))
if err != nil {

View file

@ -490,6 +490,7 @@ type Request struct {
}
// Hash returns a hash of the unique aspects of the Request
//
//nolint:errcheck
func (r *Request) Hash() string {
h := sha256.New()

View file

@ -20,6 +20,7 @@ import (
"time"
"github.com/google/uuid"
"github.com/osbuild/osbuild-composer/pkg/jobqueue"
"github.com/osbuild/osbuild-composer/internal/jsondb"
@ -566,8 +567,8 @@ func (q *fsJobQueue) removePendingJob(id uuid.UUID) {
// jobMatchesCriteria returns true if it matches criteria defined in parameters
//
// Criteria:
// - the job's type is one of the acceptedJobTypes
// - the job's channel is one of the acceptedChannels
// - the job's type is one of the acceptedJobTypes
// - the job's channel is one of the acceptedChannels
func jobMatchesCriteria(j *job, acceptedJobTypes []string, acceptedChannels []string) bool {
contains := func(slice []string, str string) bool {
for _, item := range slice {

View file

@ -243,13 +243,17 @@ func (k *Koji) CGInitBuild(name, version, release string) (*CGInitBuildResult, e
return &result, nil
}
/* from `koji/__init__.py`
/*
from `koji/__init__.py`
BUILD_STATES = Enum((
'BUILDING',
'COMPLETE',
'DELETED',
'FAILED',
'CANCELED',
'BUILDING',
'COMPLETE',
'DELETED',
'FAILED',
'CANCELED',
))
*/
const (