Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: update to go 1.18 #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/coder-test-stability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -43,7 +43,7 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: "^1.17"
go-version: "~1.18"

- uses: actions/cache@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.43.0
version: v1.45.2

style-lint-typescript:
name: "style/lint/typescript"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand Down
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions cli/cliui/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
},
Expand Down
2 changes: 2 additions & 0 deletions coderd/database/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
3 changes: 3 additions & 0 deletions coderd/database/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions coderd/provisionerjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions codersdk/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading