Bump go to 1.19.1 (#7690)

* Bump go to 1.19.1

* Bump remaining go-version to the 1.19.1

* Add extra paths for test-go

* Oops, putting the right path in the right place

* gofmt file

* gofmt ALL THE THINGS

* Moar changes

* Actually, go.mod doesn't like minor versions
This commit is contained in:
Tomas Touceda 2022-09-12 20:32:43 -03:00 committed by GitHub
parent 9eafecd95e
commit 8457e55b53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 126 additions and 113 deletions

View File

@ -31,7 +31,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: 1.17.8 go-version: 1.19.1
- name: Install Go Dependencies - name: Install Go Dependencies
run: make deps-go run: make deps-go

View File

@ -17,7 +17,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: 1.17 go-version: 1.19.1
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2

View File

@ -42,7 +42,7 @@ jobs:
timeout-minutes: 60 timeout-minutes: 60
strategy: strategy:
matrix: matrix:
go-version: ['^1.17.0'] go-version: ['^1.19.1']
mysql: ['mysql:5.7'] mysql: ['mysql:5.7']
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: gen needs: gen
@ -132,7 +132,7 @@ jobs:
timeout-minutes: 60 timeout-minutes: 60
strategy: strategy:
matrix: matrix:
go-version: ['^1.17.0'] go-version: ['^1.19.1']
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: gen needs: gen
steps: steps:
@ -180,7 +180,7 @@ jobs:
timeout-minutes: 60 timeout-minutes: 60
strategy: strategy:
matrix: matrix:
go-version: ['^1.17.0'] go-version: ['^1.19.1']
# We can only generate all (PKG, MSI, DEB, RPM) packages from a macOS host. # We can only generate all (PKG, MSI, DEB, RPM) packages from a macOS host.
runs-on: macos-latest runs-on: macos-latest
needs: gen needs: gen

View File

@ -37,7 +37,7 @@ jobs:
matrix: matrix:
# Doesn't work on Windows because Linux Docker containers are not supported. # Doesn't work on Windows because Linux Docker containers are not supported.
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
go-version: ['1.17.9'] go-version: ['1.19.1']
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@ -27,7 +27,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: '^1.17.0' go-version: '^1.19.1'
- name: Checkout - name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
@ -73,7 +73,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: '^1.17.0' go-version: '^1.19.1'
- name: Checkout - name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
@ -96,7 +96,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: '^1.17.0' go-version: '^1.19.1'
- name: Checkout - name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2

View File

@ -9,6 +9,7 @@ on:
pull_request: pull_request:
paths: paths:
- '**.go' - '**.go'
- '.github/workflows/golangci-lint.yml'
workflow_dispatch: # Manual workflow_dispatch: # Manual
permissions: permissions:
@ -26,7 +27,7 @@ jobs:
- uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a - uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a
with: with:
go-version: '1.17' go-version: '1.19.1'
- name: Run go lint - name: Run go lint
run: | run: |

View File

@ -29,7 +29,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: 1.17.8 go-version: 1.19.1
- name: Install JS Dependencies - name: Install JS Dependencies
run: make deps-js run: make deps-js

View File

@ -42,7 +42,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: 1.19.0 go-version: 1.19.1
- name: Run GoReleaser - name: Run GoReleaser
run: go run github.com/goreleaser/goreleaser@v1.9.2 release --rm-dist -f orbit/.goreleaser.yml run: go run github.com/goreleaser/goreleaser@v1.9.2 release --rm-dist -f orbit/.goreleaser.yml

View File

@ -27,7 +27,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: 1.17.8 go-version: 1.19.1
- name: Install Dependencies - name: Install Dependencies
run: make deps run: make deps

View File

@ -14,6 +14,7 @@ on:
- '**.go' - '**.go'
- 'go.mod' - 'go.mod'
- 'go.sum' - 'go.sum'
- '.github/workflows/test-go.yaml'
workflow_dispatch: # Manual workflow_dispatch: # Manual
schedule: schedule:
- cron: '0 4 * * *' - cron: '0 4 * * *'
@ -26,7 +27,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
go-version: ['^1.17.8'] go-version: ['^1.19.1']
mysql: ["mysql:5.7.21", "mysql:8.0.28"] mysql: ["mysql:5.7.21", "mysql:8.0.28"]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}

View File

@ -33,7 +33,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
go-version: ['^1.17.8'] go-version: ['^1.19.1']
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@ -22,7 +22,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2 uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v2
with: with:
go-version: '^1.17.8' go-version: '^1.19.1'
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2 uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2

View File

@ -31,7 +31,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
go-version: ['^1.17.8'] go-version: ['^1.19.1']
fleet-tier: [free, premium] fleet-tier: [free, premium]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@ -1,4 +1,4 @@
FROM --platform=linux/amd64 golang:1.19.0-bullseye FROM --platform=linux/amd64 golang:1.19.1-bullseye
LABEL maintainer="Fleet Developers <hello@fleetdm.com>" LABEL maintainer="Fleet Developers <hello@fleetdm.com>"
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \

View File

@ -1,4 +1,4 @@
FROM golang:1.19.0-alpine FROM golang:1.19.1-alpine
ARG ENROLL_SECRET ARG ENROLL_SECRET
ARG HOST_COUNT ARG HOST_COUNT

View File

@ -1,7 +1,7 @@
FROM golang:1.19.0 FROM golang:1.19.1
ARG TAG ARG TAG
RUN apt update && apt upgrade -y && apt install npm yarnpkg -y && ln -s /usr/bin/yarnpkg /usr/bin/yarn RUN apt update && apt upgrade -y && apt install npm yarnpkg -y && ln -s /usr/bin/yarnpkg /usr/bin/yarn
RUN git clone -b $TAG https://github.com/fleetdm/fleet.git && cd /go/fleet/cmd/osquery-perf/ && go build . RUN git clone -b $TAG https://github.com/fleetdm/fleet.git && cd /go/fleet/cmd/osquery-perf/ && go build .
FROM golang:1.19.0 FROM golang:1.19.1
COPY --from=0 /go/fleet/cmd/osquery-perf/osquery-perf /go/osquery-perf COPY --from=0 /go/fleet/cmd/osquery-perf/osquery-perf /go/osquery-perf

View File

@ -1,4 +1,4 @@
FROM golang:1.19-alpine AS builder FROM golang:1.19.1-alpine AS builder
RUN apk update && apk add --no-cache git curl openssl unzip RUN apk update && apk add --no-cache git curl openssl unzip
WORKDIR /build WORKDIR /build
COPY . . COPY . .

View File

@ -1,4 +1,4 @@
FROM golang:1.19-alpine AS builder FROM golang:1.19.1-alpine AS builder
WORKDIR /build WORKDIR /build
COPY . . COPY . .
RUN go get -d -v RUN go get -d -v

View File

@ -15,8 +15,8 @@ import (
"github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
"github.com/aws/aws-sdk-go/service/sfn" "github.com/aws/aws-sdk-go/service/sfn"
"github.com/fleetdm/fleet/v4/server/service"
"github.com/fleetdm/fleet/v4/pkg/spec" "github.com/fleetdm/fleet/v4/pkg/spec"
"github.com/fleetdm/fleet/v4/server/service"
"github.com/loopfz/gadgeto/tonic" "github.com/loopfz/gadgeto/tonic"
"github.com/wI2L/fizz" "github.com/wI2L/fizz"
"github.com/wI2L/fizz/openapi" "github.com/wI2L/fizz/openapi"
@ -24,9 +24,9 @@ import (
_ "go.elastic.co/apm/v2" _ "go.elastic.co/apm/v2"
"log" "log"
"math/rand" "math/rand"
"os"
"strings" "strings"
"time" "time"
"os"
) )
type OptionsStruct struct { type OptionsStruct struct {
@ -39,7 +39,7 @@ type OptionsStruct struct {
var options = OptionsStruct{} var options = OptionsStruct{}
func applyConfig(c* gin.Context, url, token string) (err error) { func applyConfig(c *gin.Context, url, token string) (err error) {
var client *service.Client var client *service.Client
if client, err = service.NewClient(url, false, "", ""); err != nil { if client, err = service.NewClient(url, false, "", ""); err != nil {
log.Print(err) log.Print(err)

View File

@ -1,4 +1,4 @@
FROM golang:1.19-alpine AS builder FROM golang:1.19.1-alpine AS builder
WORKDIR /build WORKDIR /build
COPY . . COPY . .
RUN go get -d -v RUN go get -d -v

View File

@ -6,7 +6,7 @@ RUN cargo install --version 0.16.0 apple-codesign \
&& curl -sSf $transporter_url -o transporter_install.sh \ && curl -sSf $transporter_url -o transporter_install.sh \
&& sh transporter_install.sh --target transporter --accept --noexec && sh transporter_install.sh --target transporter --accept --noexec
FROM golang:1.19.0-bullseye FROM golang:1.19.1-bullseye
RUN apt-get update \ RUN apt-get update \
&& dpkg --add-architecture i386 \ && dpkg --add-architecture i386 \

View File

@ -99,11 +99,11 @@ const (
// It sets the environment of the current process so that it gets inherited by // It sets the environment of the current process so that it gets inherited by
// the child process (see call to CreateEnvironmentBlock). // the child process (see call to CreateEnvironmentBlock).
// From https://docs.microsoft.com/en-us/windows/win32/procthread/changing-environment-variables: // From https://docs.microsoft.com/en-us/windows/win32/procthread/changing-environment-variables:
//
// "If you want the child process to inherit most of the parent's environment with // "If you want the child process to inherit most of the parent's environment with
// only a few changes, retrieve the current values using GetEnvironmentVariable, save these values, // only a few changes, retrieve the current values using GetEnvironmentVariable, save these values,
// create an updated block for the child process to inherit, create the child process, and then // create an updated block for the child process to inherit, create the child process, and then
// restore the saved values using SetEnvironmentVariable, as shown in the following example." // restore the saved values using SetEnvironmentVariable, as shown in the following example."
//
func run(path string, opts eopts) error { func run(path string, opts eopts) error {
for _, nv := range opts.env { for _, nv := range opts.env {
os.Setenv(nv[0], nv[1]) os.Setenv(nv[0], nv[1])

View File

@ -70,7 +70,7 @@ launchctl kickstart "system/${DAEMON_LABEL}"
// TODO set Nice? // TODO set Nice?
// //
//Note it's important not to start the orbit binary in // Note it's important not to start the orbit binary in
// `/usr/local/bin/orbit` because this is a path that users usually have write // `/usr/local/bin/orbit` because this is a path that users usually have write
// access to, and running that binary with launchd can become a privilege // access to, and running that binary with launchd can become a privilege
// escalation vector. // escalation vector.

View File

@ -227,6 +227,7 @@ func writeOsqueryFlagfile(opt Options, orbitRoot string) error {
// Embed the certs file that osquery uses so that we can drop it into our installation packages. // Embed the certs file that osquery uses so that we can drop it into our installation packages.
// This file copied from https://raw.githubusercontent.com/osquery/osquery/master/tools/deployment/certs.pem // This file copied from https://raw.githubusercontent.com/osquery/osquery/master/tools/deployment/certs.pem
//
//go:embed certs.pem //go:embed certs.pem
var osqueryCerts []byte var osqueryCerts []byte

View File

@ -1,4 +1,5 @@
//+build windows //go:build windows
// +build windows
package platform package platform

View File

@ -26,6 +26,7 @@ type Authorizer struct {
} }
// Load the policy from policy.rego in this directory. // Load the policy from policy.rego in this directory.
//
//go:embed policy.rego //go:embed policy.rego
var policy string var policy string

View File

@ -114,6 +114,7 @@ func (ds *Datastore) SavePolicy(ctx context.Context, p *fleet.Policy) error {
// and osquery agents bring in new failing results from them then those will be returned here // and osquery agents bring in new failing results from them then those will be returned here
// (in newFailing or newPassing). // (in newFailing or newPassing).
// - Similar in case a host was deleted. // - Similar in case a host was deleted.
//
// Trying to filter those out here would make this operation more expensive (fetch policies from the // Trying to filter those out here would make this operation more expensive (fetch policies from the
// `policies` table and querying the `hosts` table). // `policies` table and querying the `hosts` table).
func (ds *Datastore) FlippingPoliciesForHost( func (ds *Datastore) FlippingPoliciesForHost(

View File

@ -1,7 +1,7 @@
// Package live_query implements an interface for storing and // Package live_query implements an interface for storing and
// retrieving live queries. // retrieving live queries.
// //
// Design // # Design
// //
// This package operates by storing a single redis key for host // This package operates by storing a single redis key for host
// targeting information. This key has a known prefix, and the data // targeting information. This key has a known prefix, and the data
@ -21,7 +21,7 @@
// number of live queries targeting all of them. This was a big // number of live queries targeting all of them. This was a big
// factor in choosing this implementation. // factor in choosing this implementation.
// //
// Implementation // # Implementation
// //
// As mentioned in the Design section, there are three keys for each // As mentioned in the Design section, there are three keys for each
// live query: the bitfield, the SQL of the query and the set containing // live query: the bitfield, the SQL of the query and the set containing
@ -42,7 +42,6 @@
// live on a single node in cluster mode (a "hot key"), and that node will see // live on a single node in cluster mode (a "hot key"), and that node will see
// increased activity due to that. Should that become a significant problem, an // increased activity due to that. Should that become a significant problem, an
// alternative approach will be required. // alternative approach will be required.
//
package live_query package live_query
import ( import (
@ -84,6 +83,7 @@ func generateKeys(name string) (targetsKey, sqlKey string) {
} }
// returns the base name part of a target key, i.e. so that this is true: // returns the base name part of a target key, i.e. so that this is true:
//
// tkey, _ := generateKeys(name) // tkey, _ := generateKeys(name)
// baseName := extractTargetKeyName(tkey) // baseName := extractTargetKeyName(tkey)
// baseName == name // baseName == name

View File

@ -9,9 +9,9 @@ import (
"github.com/fleetdm/fleet/v4/server/fleet" "github.com/fleetdm/fleet/v4/server/fleet"
) )
///////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////
// Fleet Desktop endpoints // Fleet Desktop endpoints
///////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////
type getFleetDesktopResponse struct { type getFleetDesktopResponse struct {
Err error `json:"error,omitempty"` Err error `json:"error,omitempty"`
FailingPolicies *uint `json:"failing_policies_count,omitempty"` FailingPolicies *uint `json:"failing_policies_count,omitempty"`

View File

@ -72,12 +72,16 @@ func mapCriteria(i oval_input.CriteriaXML) (*oval_parsed.Criteria, error) {
// Test objects can define their 'name' in one of two ways: // Test objects can define their 'name' in one of two ways:
// 1. Inline: // 1. Inline:
// <:object ...> // <:object ...>
//
// <:name>software name</:name> // <:name>software name</:name>
//
// </:object> // </:object>
// //
// 2. As a variable reference: // 2. As a variable reference:
// <:object ...> // <:object ...>
//
// <:name var_ref="var:200224390000000" var_check="at least one" /> // <:name var_ref="var:200224390000000" var_check="at least one" />
//
// </:object> // </:object>
func mapPackageInfoTestObject( func mapPackageInfoTestObject(
obj oval_input.PackageInfoTestObjectXML, obj oval_input.PackageInfoTestObjectXML,

View File

@ -35,6 +35,7 @@ func (t *DpkgInfoTest) Eval(packages []fleet.Software) ([]fleet.Software, error)
} }
// Returns: // Returns:
//
// nObjects: How many items in the set defined by the OVAL Object set exists in the system. // nObjects: How many items in the set defined by the OVAL Object set exists in the system.
// nStates: How many items in the set defined by the OVAL Object set satisfy the state requirements. // nStates: How many items in the set defined by the OVAL Object set satisfy the state requirements.
// Slice with software matching both the object and state criteria. // Slice with software matching both the object and state criteria.

View File

@ -35,6 +35,7 @@ func (t *RpmInfoTest) Eval(packages []fleet.Software) ([]fleet.Software, error)
} }
// Returns: // Returns:
//
// nObjects: How many items in the set defined by the OVAL Object set exists in the system. // nObjects: How many items in the set defined by the OVAL Object set exists in the system.
// nStates: How many items in the set defined by the OVAL Object set satisfy the state requirements. // nStates: How many items in the set defined by the OVAL Object set satisfy the state requirements.
// Slice with software matching both the object and state criteria. // Slice with software matching both the object and state criteria.

View File

@ -15,6 +15,7 @@ import (
// - RELEASEs are compared using the rpmvercmp algo, if equal then both are equal. // - RELEASEs are compared using the rpmvercmp algo, if equal then both are equal.
// //
// Returns: // Returns:
//
// -1 if a < b // -1 if a < b
// 0 if a == b // 0 if a == b
// 1 if a > b // 1 if a > b

View File

@ -3,13 +3,13 @@
// the configuration get properly passed down to the pool creation. // the configuration get properly passed down to the pool creation.
// //
// To run a TLS redis server: // To run a TLS redis server:
// * Build redis from source with `make BUILD_TLS=yes` (https://redis.io/topics/encryption) // - Build redis from source with `make BUILD_TLS=yes` (https://redis.io/topics/encryption)
// * Generate certificates and keys with `./utils/gen-test-certs.sh` // - Generate certificates and keys with `./utils/gen-test-certs.sh`
// (the generated files will be under ./tests/tls/) // (the generated files will be under ./tests/tls/)
// * Run `./src/redis-server --tls-port 7379 --port 0 --tls-ca-cert-file // - Run `./src/redis-server --tls-port 7379 --port 0 --tls-ca-cert-file
// ./tests/tls/ca.crt --tls-cert-file ./tests/tls/redis.crt --tls-key-file // ./tests/tls/ca.crt --tls-cert-file ./tests/tls/redis.crt --tls-key-file
// ./tests/tls/redis.key` // ./tests/tls/redis.key`
// * Run this command to test connection, e.g.: // - Run this command to test connection, e.g.:
// `go run ./tools/redis-tests/tlsconnect.go -- -addr localhost:7379 -cacert ./tests/tls/ca.crt // `go run ./tools/redis-tests/tlsconnect.go -- -addr localhost:7379 -cacert ./tests/tls/ca.crt
// -cert ./tests/tls/redis.crt -key ./tests/tls/redis.key PING` -skip // -cert ./tests/tls/redis.crt -key ./tests/tls/redis.key PING` -skip
package main package main