Skip to content

Commit

Permalink
Merge pull request #126 from swagatbora90/update-go-firecracker
Browse files Browse the repository at this point in the history
Update go version
  • Loading branch information
swagatbora90 authored May 22, 2024
2 parents b2dc89f + 97239c7 commit 42c3307
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

env:
# The CI system uses Debian 10 with go from stable backports:
PATH: "/usr/lib/go-1.17/bin:/usr/bin"
PATH: "/usr/local/bin:/usr/bin"
# Firectl tests will run against this version of firecracker:
FIRECRACKER_VERSION: 1.0.0
# Firecracker binaries will be installed and run from this directory:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
build:
strategy:
matrix:
go: ['1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20']
os: ['ubuntu-20.04']
go: ['1.21', '1.22']
os: ['ubuntu-20.04', 'ubuntu-22.04']

name: ${{ matrix.os }} / Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
Expand Down
36 changes: 16 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,34 @@ else
endif

build-in-docker:
docker run --rm -v $(CURDIR):/firectl --workdir /firectl golang:1.14 make
docker run --rm -v $(CURDIR):/firectl --workdir /firectl golang:1.22 make

test:
go test -v ./...

GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
deps = \
$(BINPATH)/golangci-lint \
$(BINPATH)/git-validation \
$(BINPATH)/ltag

$(BINPATH)/ltag:
@if [ $(GO_MINOR_VERSION) -lt 16 ]; then \
GOBIN=$(BINPATH) GO111MODULE=on go get github.com/kunalkushwaha/[email protected]; \
else \
GOBIN=$(BINPATH) GO111MODULE=on go install github.com/kunalkushwaha/[email protected]; \
fi

$(BINPATH)/git-validation:
@if [ $(GO_MINOR_VERSION) -lt 16 ]; then \
GOBIN=$(BINPATH) GO111MODULE=on go get github.com/vbatts/[email protected]; \
else \
GOBIN=$(BINPATH) GO111MODULE=on go install github.com/vbatts/[email protected]; \
fi
lint: $(deps)
$(BINPATH)/ltag -t ./.headers -excludes "tools $(SUBMODULES)" -check -v
$(BINPATH)/git-validation -run DCO,short-subject -range HEAD~5..HEAD
$(BINPATH)/golangci-lint run

$(BINPATH)/golangci-lint:
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(BINPATH) v1.53.3
GOBIN=$(BINPATH) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.2
$(BINPATH)/golangci-lint --version

lint: $(BINPATH)/ltag $(BINPATH)/git-validation $(BINPATH)/golangci-lint
$(BINPATH)/ltag -v -t ./.headers -check
$(BINPATH)/git-validation -q -run DCO,short-subject -range HEAD~5..HEAD
$(BINPATH)/golangci-lint run
$(BINPATH)/git-validation:
GOBIN=$(BINPATH) go install github.com/vbatts/[email protected]

$(BINPATH)/ltag:
GOBIN=$(BINPATH) go install github.com/kunalkushwaha/[email protected]

clean:
go clean
rm -rf $(BINPATH)

install:
install -o root -g root -m755 -t $(INSTALLPATH) firectl
Expand Down
41 changes: 40 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,50 @@
module github.com/firecracker-microvm/firectl

go 1.14
go 1.21

require (
github.com/firecracker-microvm/firecracker-go-sdk v1.0.0
github.com/go-openapi/strfmt v0.21.2
github.com/jessevdk/go-flags v1.5.0
github.com/sirupsen/logrus v1.9.3
)

require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/containerd/fifo v1.0.0 // indirect
github.com/containernetworking/cni v1.0.1 // indirect
github.com/containernetworking/plugins v1.0.1 // indirect
github.com/go-openapi/analysis v0.21.2 // indirect
github.com/go-openapi/errors v0.20.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/loads v0.21.1 // indirect
github.com/go-openapi/runtime v0.24.0 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/go-openapi/validate v0.22.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/tidwall/pretty v1.0.1 // indirect
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 // indirect
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect
go.mongodb.org/mongo-driver v1.8.3 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

// Workaround for indirect dependency no longer being available.
// https://github.com/containerd/containerd/issues/9969
exclude github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f
5 changes: 0 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
Expand Down Expand Up @@ -495,7 +494,6 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs=
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
Expand Down Expand Up @@ -896,7 +894,6 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JC
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -958,7 +955,6 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
Expand Down Expand Up @@ -1024,7 +1020,6 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
Expand Down
4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import (
"context"
"os"
"os/exec"
"runtime"
"syscall"
"testing"
"runtime"
"time"

models "github.com/firecracker-microvm/firecracker-go-sdk/client/models"

"github.com/firecracker-microvm/firecracker-go-sdk"
firecracker "github.com/firecracker-microvm/firecracker-go-sdk"
client "github.com/firecracker-microvm/firecracker-go-sdk/client"
ops "github.com/firecracker-microvm/firecracker-go-sdk/client/operations"
"github.com/go-openapi/strfmt"
Expand Down
5 changes: 2 additions & 3 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
Expand Down Expand Up @@ -244,9 +243,9 @@ func (opts *options) handleFifos() (io.Writer, error) {
}

if generateFifoFilename || generateMetricFifoFilename {
dir, err := ioutil.TempDir(os.TempDir(), "fcfifo")
dir, err := os.MkdirTemp(os.TempDir(), "fcfifo")
if err != nil {
return fifo, fmt.Errorf("Fail to create temporary directory: %v", err)
return fifo, fmt.Errorf("fail to create temporary directory: %v", err)
}
opts.addCloser(func() error {
return os.RemoveAll(dir)
Expand Down
7 changes: 3 additions & 4 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package main

import (
"io/ioutil"
"os"
"reflect"
"strings"
Expand All @@ -25,7 +24,7 @@ import (
)

func TestGetFirecrackerConfig(t *testing.T) {
tempFile, err := ioutil.TempFile("", "firectl-test-drive-path")
tempFile, err := os.CreateTemp("", "firectl-test-drive-path")
if err != nil {
t.Error(err)
}
Expand Down Expand Up @@ -209,7 +208,7 @@ func TestParseDevice(t *testing.T) {
}

func TestParseBlockDevices(t *testing.T) {
tempFile, err := ioutil.TempFile("", "firectl-test-drive-path")
tempFile, err := os.CreateTemp("", "firectl-test-drive-path")
if err != nil {
t.Error(err)
}
Expand Down Expand Up @@ -628,7 +627,7 @@ func TestGetFirecrackerNetworkingConfig(t *testing.T) {
}

func TestGetBlockDevices(t *testing.T) {
tempFile, err := ioutil.TempFile("", "firectl-test-drive-path")
tempFile, err := os.CreateTemp("", "firectl-test-drive-path")
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit 42c3307

Please sign in to comment.