diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml index fe2b2c3eb0..a5500934e4 100644 --- a/.github/actions/setup-go/action.yml +++ b/.github/actions/setup-go/action.yml @@ -32,7 +32,7 @@ runs: steps: - name: Install Go id: setup-go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version: ${{ inputs.go-version }} check-latest: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c880d3123f..57ba1e41ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,15 @@ jobs: matrix: goos: [windows, linux] root: ["", test] # cannot specify "./... ./test/..." unless in go workspace + tags: [""] + include: + # add LCOW/WCOW specific configurations + - goos: windows + root: "" + tags: lcow + - goos: windows + root: "" + tags: wcow steps: - name: Checkout @@ -36,7 +45,7 @@ jobs: - name: Run golangci-lint uses: golangci/golangci-lint-action@v9 with: - version: v2.1 + version: v2.11 args: >- --verbose --max-issues-per-linter=0 @@ -44,6 +53,7 @@ jobs: --modules-download-mode=readonly --timeout=10m --config=${{ github.workspace }}/.golangci.yml + ${{ case(matrix.tags != '', format('--build-tags {0}', matrix.tags), '') }} working-directory: ${{ github.workspace }}/${{ matrix.root }} env: GOOS: ${{ matrix.goos }} @@ -269,8 +279,7 @@ jobs: strategy: fail-fast: false matrix: - name: - [windows-2022] + name: [windows-2022] include: - name: "windows-2022" runner: [self-hosted, 1ES.Pool=containerplat-github-runner-pool-east-us-2, 1ES.ImageOverride=github-mms-ws2022-containers-enabled] diff --git a/hcn/hcnnamespace.go b/hcn/hcnnamespace.go index e855f5a3aa..5b93c47913 100644 --- a/hcn/hcnnamespace.go +++ b/hcn/hcnnamespace.go @@ -18,12 +18,12 @@ import ( // NamespaceResourceEndpoint represents an Endpoint attached to a Namespace. type NamespaceResourceEndpoint struct { - Id string `json:"ID,"` + Id string `json:"ID"` } // NamespaceResourceContainer represents a Container attached to a Namespace. type NamespaceResourceContainer struct { - Id string `json:"ID,"` + Id string `json:"ID"` } // NamespaceResourceType determines whether the Namespace resource is a Container or Endpoint. @@ -38,8 +38,8 @@ var ( // NamespaceResource is associated with a namespace type NamespaceResource struct { - Type NamespaceResourceType `json:","` // Container, Endpoint - Data json.RawMessage `json:","` + Type NamespaceResourceType `json:""` // Container, Endpoint + Data json.RawMessage `json:""` } // NamespaceType determines whether the Namespace is for a Host or Guest diff --git a/hcn/hcnpolicy.go b/hcn/hcnpolicy.go index 87af5e5802..d7fae8050a 100644 --- a/hcn/hcnpolicy.go +++ b/hcn/hcnpolicy.go @@ -127,8 +127,8 @@ const ( // AclPolicySetting creates firewall rules on an endpoint type AclPolicySetting struct { Protocols string `json:",omitempty"` // EX: 6 (TCP), 17 (UDP), 1 (ICMPv4), 58 (ICMPv6), 2 (IGMP) - Action ActionType `json:","` - Direction DirectionType `json:","` + Action ActionType `json:""` + Direction DirectionType `json:""` LocalAddresses string `json:",omitempty"` RemoteAddresses string `json:",omitempty"` LocalPorts string `json:",omitempty"` @@ -161,8 +161,8 @@ type SDNRoutePolicySetting struct { // NetworkACLPolicySetting creates ACL rules on a network type NetworkACLPolicySetting struct { Protocols string `json:",omitempty"` // EX: 6 (TCP), 17 (UDP), 1 (ICMPv4), 58 (ICMPv6), 2 (IGMP) - Action ActionType `json:","` - Direction DirectionType `json:","` + Action ActionType `json:""` + Direction DirectionType `json:""` LocalAddresses string `json:",omitempty"` RemoteAddresses string `json:",omitempty"` LocalPorts string `json:",omitempty"` @@ -267,12 +267,12 @@ type LayerConstraintNetworkPolicySetting struct { // VlanPolicySetting isolates a subnet with VLAN tagging. type VlanPolicySetting struct { - IsolationId uint32 `json:","` + IsolationId uint32 `json:""` } // VsidPolicySetting isolates a subnet with VSID tagging. type VsidPolicySetting struct { - IsolationId uint32 `json:","` + IsolationId uint32 `json:""` } // RemoteSubnetRoutePolicySetting creates remote subnet route rules on a network @@ -330,7 +330,7 @@ type L4ProxyPolicySetting struct { type TierAclRule struct { Id string `json:",omitempty"` Protocols string `json:",omitempty"` - TierAclRuleAction ActionType `json:","` + TierAclRuleAction ActionType `json:""` LocalAddresses string `json:",omitempty"` RemoteAddresses string `json:",omitempty"` LocalPorts string `json:",omitempty"` @@ -340,8 +340,8 @@ type TierAclRule struct { // TierAclPolicySetting represents a Tier containing ACLs type TierAclPolicySetting struct { - Name string `json:","` - Direction DirectionType `json:","` + Name string `json:""` + Direction DirectionType `json:""` Order uint16 `json:""` TierAclRules []TierAclRule `json:",omitempty"` } diff --git a/internal/gcs/process.go b/internal/gcs/process.go index 91d3a87faa..4c2428a657 100644 --- a/internal/gcs/process.go +++ b/internal/gcs/process.go @@ -145,7 +145,7 @@ func (p *Process) Close() error { // CloseStdin causes the process to read EOF on its stdin stream. func (p *Process) CloseStdin(ctx context.Context) (err error) { - ctx, span := oc.StartSpan(ctx, "gcs::Process::CloseStdin") //nolint:ineffassign,staticcheck + _, span := oc.StartSpan(ctx, "gcs::Process::CloseStdin") defer span.End() defer func() { oc.SetSpanStatus(span, err) }() span.AddAttributes( @@ -159,7 +159,7 @@ func (p *Process) CloseStdin(ctx context.Context) (err error) { } func (p *Process) CloseStdout(ctx context.Context) (err error) { - ctx, span := oc.StartSpan(ctx, "gcs::Process::CloseStdout") //nolint:ineffassign,staticcheck + _, span := oc.StartSpan(ctx, "gcs::Process::CloseStdout") defer span.End() defer func() { oc.SetSpanStatus(span, err) }() span.AddAttributes( @@ -170,7 +170,7 @@ func (p *Process) CloseStdout(ctx context.Context) (err error) { } func (p *Process) CloseStderr(ctx context.Context) (err error) { - ctx, span := oc.StartSpan(ctx, "gcs::Process::CloseStderr") //nolint:ineffassign,staticcheck + _, span := oc.StartSpan(ctx, "gcs::Process::CloseStderr") defer span.End() defer func() { oc.SetSpanStatus(span, err) }() span.AddAttributes( diff --git a/internal/guest/network/network.go b/internal/guest/network/network.go index 49564126a6..cc06398e41 100644 --- a/internal/guest/network/network.go +++ b/internal/guest/network/network.go @@ -42,9 +42,9 @@ func GenerateEtcHostsContent(ctx context.Context, hostname string) string { buf := bytes.Buffer{} buf.WriteString("127.0.0.1 localhost\n") if len(nameParts) > 1 { - buf.WriteString(fmt.Sprintf("127.0.0.1 %s %s\n", hostname, nameParts[0])) + fmt.Fprintf(&buf, "127.0.0.1 %s %s\n", hostname, nameParts[0]) } else { - buf.WriteString(fmt.Sprintf("127.0.0.1 %s\n", hostname)) + fmt.Fprintf(&buf, "127.0.0.1 %s\n", hostname) } buf.WriteString("\n") buf.WriteString("# The following lines are desirable for IPv6 capable hosts\n")