chore: update to go 1.18 (#628)

* add make lint to Makefile
This commit is contained in:
Colin Adler 2022-03-28 14:14:40 -05:00 committed by GitHub
parent b33dec9d38
commit be8389fd74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 35 additions and 561 deletions

View File

@ -14,9 +14,9 @@ on:
workflow_dispatch:
inputs:
iterationCount:
description: 'Iteration Count'
description: "Iteration Count"
required: false
default: '10'
default: "10"
# Cancel in-progress runs for pull requests when developers push
# additional changes, and serialize builds in branches.
@ -43,7 +43,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: "^1.17"
go-version: "~1.18"
- uses: actions/cache@v3
with:

View File

@ -44,7 +44,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.1.0
with:
version: v1.43.0
version: v1.45.2
style-lint-typescript:
name: "style/lint/typescript"
@ -201,7 +201,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: "~1.17"
go-version: "~1.18"
- name: Echo Go Cache Paths
id: go-cache-paths
@ -299,7 +299,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: "~1.17"
go-version: "~1.18"
- name: Echo Go Cache Paths
id: go-cache-paths
@ -362,7 +362,7 @@ jobs:
# Go is required for uploading the test results to datadog
- uses: actions/setup-go@v2
with:
go-version: "~1.17"
go-version: "~1.18"
- uses: actions/setup-node@v3
with:

View File

@ -12,7 +12,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: "^1.17"
go-version: "~1.18"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2.9.1

View File

@ -154,7 +154,7 @@ linters-settings:
- name: import-shadowing
- name: increment-decrement
- name: indent-error-flow
- name: modifies-parameter
# - name: modifies-parameter
- name: modifies-value-receiver
- name: package-comments
- name: range
@ -185,6 +185,8 @@ linters-settings:
- i
- db
- t
- id
- wg
# Optional list of variable declarations that should be ignored completely. (defaults to empty list)
# Entries must be in the form of "<variable name> <type>" or "<variable name> *<type>" for
# variables, or "const <name>" for constants.
@ -193,6 +195,8 @@ linters-settings:
- r *http.Request
- t testing.T
- t testing.TB
- ok bool
- wg sync.WaitGroup
issues:
# Rules listed here: https://github.com/securego/gosec#available-rules

View File

@ -88,3 +88,8 @@ site/out:
# Restores GITKEEP files!
git checkout HEAD site/out
.PHONY: site/out
lint:
@echo "--- golangci-lint"
golangci-lint run
.PHONY: lint

View File

@ -35,12 +35,15 @@ func Select(cmd *cobra.Command, opts SelectOptions) (string, error) {
Templates: &promptui.SelectTemplates{
FuncMap: template.FuncMap{
"faint": func(value interface{}) string {
//nolint:forcetypeassert
return Styles.Placeholder.Render(value.(string))
},
"subtle": func(value interface{}) string {
//nolint:forcetypeassert
return defaultStyles.Subtle.Render(value.(string))
},
"selected": func(value interface{}) string {
//nolint:forcetypeassert
return defaultStyles.Keyword.Render("> " + value.(string))
// return defaultStyles.SelectedMenuItem.Render("> " + value.(string))
},

View File

@ -138,5 +138,7 @@ func getFreePort() (port int, err error) {
}
defer listener.Close()
// This is always a *net.TCPAddr.
// nolint:forcetypeassert
return listener.Addr().(*net.TCPAddr).Port, nil
}

View File

@ -72,6 +72,9 @@ func (p *pgPubsub) Subscribe(event string, listener Listener) (cancel func(), er
}
func (p *pgPubsub) Publish(event string, message []byte) error {
// This is safe because we are calling pq.QuoteLiteral. pg_notify doesn't
// support the first parameter being a prepared statement.
//nolint:gosec
_, err := p.db.ExecContext(context.Background(), `select pg_notify(`+pq.QuoteLiteral(event)+`, $1)`, message)
if err != nil {
return xerrors.Errorf("exec: %w", err)

View File

@ -138,7 +138,9 @@ func (api *api) provisionerJobLogs(rw http.ResponseWriter, r *http.Request, job
// See: https://canjs.com/doc/can-ndjson-stream.html
rw.Header().Set("Content-Type", "application/stream+json")
rw.WriteHeader(http.StatusOK)
rw.(http.Flusher).Flush()
if flusher, ok := rw.(http.Flusher); ok {
flusher.Flush()
}
// The Go stdlib JSON encoder appends a newline character after message write.
encoder := json.NewEncoder(rw)
@ -161,7 +163,9 @@ func (api *api) provisionerJobLogs(rw http.ResponseWriter, r *http.Request, job
if err != nil {
return
}
rw.(http.Flusher).Flush()
if flusher, ok := rw.(http.Flusher); ok {
flusher.Flush()
}
case <-ticker.C:
job, err := api.Database.GetProvisionerJobByID(r.Context(), job.ID)
if err != nil {

View File

@ -94,6 +94,7 @@ func readBodyAsError(res *http.Response) error {
}
}
//nolint:varnamelen
var m httpapi.Response
err := json.NewDecoder(res.Body).Decode(&m)
if err != nil {

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/coder/coder
go 1.17
go 1.18
// Required until https://github.com/manifoldco/promptui/pull/169 is merged.
replace github.com/manifoldco/promptui => github.com/kylecarbs/promptui v0.8.1-0.20201231190244-d8f2159af2b2

549
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -192,6 +192,7 @@ func TestConn(t *testing.T) {
_ = server.Serve(srv)
}()
//nolint:forcetypeassert
defaultTransport := http.DefaultTransport.(*http.Transport).Clone()
var cch *peer.Channel
defaultTransport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {