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
6 changed files with 15 additions and 49 deletions

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)