registry/test: staticcheck
This commit is contained in:
parent
c6cea8efc3
commit
e347b012df
|
@ -8,10 +8,8 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
version "github.com/hashicorp/go-version"
|
|
||||||
svchost "github.com/hashicorp/terraform-svchost"
|
svchost "github.com/hashicorp/terraform-svchost"
|
||||||
"github.com/hashicorp/terraform-svchost/auth"
|
"github.com/hashicorp/terraform-svchost/auth"
|
||||||
"github.com/hashicorp/terraform-svchost/disco"
|
"github.com/hashicorp/terraform-svchost/disco"
|
||||||
|
@ -51,8 +49,6 @@ type testMod struct {
|
||||||
// Only one version for now, as we only lookup latest from the registry.
|
// Only one version for now, as we only lookup latest from the registry.
|
||||||
type testProvider struct {
|
type testProvider struct {
|
||||||
version string
|
version string
|
||||||
os string
|
|
||||||
arch string
|
|
||||||
url string
|
url string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,20 +131,6 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func latestVersion(versions []string) string {
|
|
||||||
var col version.Collection
|
|
||||||
for _, v := range versions {
|
|
||||||
ver, err := version.NewVersion(v)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
col = append(col, ver)
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Sort(col)
|
|
||||||
return col[len(col)-1].String()
|
|
||||||
}
|
|
||||||
|
|
||||||
func mockRegHandler() http.Handler {
|
func mockRegHandler() http.Handler {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
|
||||||
|
@ -188,7 +170,6 @@ func mockRegHandler() http.Handler {
|
||||||
w.Header().Set("X-Terraform-Get", location)
|
w.Header().Set("X-Terraform-Get", location)
|
||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
// no body
|
// no body
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
moduleVersions := func(w http.ResponseWriter, r *http.Request) {
|
moduleVersions := func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in New Issue