Enable Go 1.18 in the ci and release workflows

* Enable Go 1.18 in the ci and release workflows

* Fix lint warning

* Add golangci as a make target
This commit is contained in:
Cosmin Cojocar 2022-03-21 16:53:22 +01:00 committed by GitHub
parent b99b5f7838
commit 607d607b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 49 deletions

View file

@ -13,6 +13,7 @@ jobs:
go_version:
- '1.16'
- '1.17'
- '1.18'
runs-on: ubuntu-latest
env:
GO111MODULE: on
@ -44,7 +45,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.17'
go-version: '1.18'
- name: Checkout Source
uses: actions/checkout@v3
- uses: actions/cache@v2

View file

@ -17,11 +17,11 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.18
- name: Install Cosign
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v1.5.2'
cosign-release: 'v1.6.0'
- name: Store Cosign private key in a file
run: 'echo "$COSIGN_KEY" > /tmp/cosign.key'
shell: bash
@ -66,7 +66,7 @@ jobs:
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}
push: true
build-args: GO_VERSION=1.17
build-args: GO_VERSION=1.18
- name: Sign Docker Image
run: cosign sign -key /tmp/cosign.key ${TAGS}
env:

View file

@ -12,7 +12,7 @@ GOBIN ?= $(GOPATH)/bin
GOLINT ?= $(GOBIN)/golint
GOSEC ?= $(GOBIN)/gosec
GINKGO ?= $(GOBIN)/ginkgo
GO_VERSION = 1.17
GO_VERSION = 1.18
default:
$(MAKE) build
@ -31,12 +31,16 @@ fmt:
@([ ! -z "$(FORMATTED)" ] && printf "Fixed unformatted files:\n$(FORMATTED)") || true
lint:
@echo "LINTING"
@echo "LINTING: golint"
$(GO_NOMOD) get -u golang.org/x/lint/golint
$(GOLINT) -set_exit_status ./...
@echo "VETTING"
$(GO) vet ./...
golangci:
@echo "LINTING: golangci-lint"
golangci-lint run
sec:
@echo "SECURITY SCANNING"
./$(BIN) ./...

View file

@ -1,7 +1,3 @@
//go:build go1.14 || !go1.11
// +build go1.14 !go1.11
// main
package main
import (

View file

@ -1,34 +0,0 @@
//go:build go1.12 && !go1.14
// +build go1.12,!go1.14
// This file can be removed once go1.13 is no longer supported
package main
import (
"crypto/tls"
"sort"
)
func mapTLSVersions(tlsVersions []string) []int {
var versions []int
for _, tlsVersion := range tlsVersions {
switch tlsVersion {
case "TLSv1.3":
versions = append(versions, tls.VersionTLS13)
case "TLSv1.2":
versions = append(versions, tls.VersionTLS12)
case "TLSv1.1":
versions = append(versions, tls.VersionTLS11)
case "TLSv1":
versions = append(versions, tls.VersionTLS10)
case "SSLv3":
// unsupported from go1.14
versions = append(versions, tls.VersionSSL30)
default:
continue
}
}
sort.Ints(versions)
return versions
}

View file

@ -1,6 +1,3 @@
//go:build go1.12
// +build go1.12
package main
import (
@ -14,9 +11,10 @@ import (
"log"
"net/http"
"path/filepath"
"strings"
"github.com/mozilla/tls-observatory/constants"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)
var (
@ -82,7 +80,8 @@ func getTLSConfFromURL(url string) (*ServerSideTLSJson, error) {
}
func getGoCipherConfig(name string, sstls ServerSideTLSJson) (goCipherConfiguration, error) {
cipherConf := goCipherConfiguration{Name: strings.Title(name)}
caser := cases.Title(language.English)
cipherConf := goCipherConfiguration{Name: caser.String(name)}
conf, ok := sstls.Configurations[name]
if !ok {
return cipherConf, fmt.Errorf("TLS configuration '%s' not found", name)