Skip to content

Commit 161e237

Browse files
authored
Merge pull request #333 from kzys/add-lint
Add "lint" target to check Amazon's license header
2 parents b453d4a + 2cf6f39 commit 161e237

16 files changed

+191
-8
lines changed

.buildkite/pipeline.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ steps:
5555

5656
- wait
5757

58-
- label: gofmt -s
59-
command: test -z $(gofmt -s -l .)
60-
# This should run in the same queue, but we don't care whether it runs on
61-
# the same host.
62-
agents:
63-
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE:-default}"
64-
6558
- label: 'git log validation'
6659
command: './.buildkite/logcheck.sh'
6760
# This should run in the same queue, but we don't care whether it runs on
@@ -92,6 +85,13 @@ steps:
9285

9386
- wait
9487

88+
- label: lint
89+
command: make lint
90+
agents:
91+
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE:-default}"
92+
distro: "${BUILDKITE_AGENT_META_DATA_DISTRO}"
93+
hostname: "${BUILDKITE_AGENT_META_DATA_HOSTNAME}"
94+
9595
- label: 'build'
9696
commands:
9797
- 'make'

.headers/go.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.

.headers/makefile.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
# not use this file except in compliance with the License. A copy of the
5+
# License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is distributed
10+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
# express or implied. See the License for the specific language governing
12+
# permissions and limitations under the License.

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ arch=$(shell uname -m)
3131

3232
# The below files are needed and can be downloaded from the internet
3333
release_url=https://github.com/firecracker-microvm/firecracker/releases/download/$(firecracker_version)/firecracker-$(firecracker_version)-$(arch).tgz
34-
testdata_objects = $(FC_TEST_DATA_PATH)/vmlinux $(FC_TEST_DATA_PATH)/root-drive.img $(FC_TEST_DATA_PATH)/jailer $(FC_TEST_DATA_PATH)/firecracker
34+
35+
testdata_objects = \
36+
$(FC_TEST_DATA_PATH)/vmlinux \
37+
$(FC_TEST_DATA_PATH)/root-drive.img \
38+
$(FC_TEST_DATA_PATH)/jailer \
39+
$(FC_TEST_DATA_PATH)/firecracker \
40+
$(FC_TEST_DATA_PATH)/ltag
41+
3542
testdata_dir = testdata/firecracker.tgz testdata/firecracker_spec-$(firecracker_version).yaml testdata/LICENSE testdata/NOTICE testdata/THIRD-PARTY
3643

3744
# --location is needed to follow redirects on github.com
@@ -78,6 +85,10 @@ $(FC_TEST_DATA_PATH)/fc.stamp:
7885
$(FC_TEST_DATA_PATH)/root-drive.img:
7986
$(curl) -o $@ https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4
8087

88+
$(FC_TEST_DATA_PATH)/ltag:
89+
GO111MODULE=off GOBIN=$(abspath $(FC_TEST_DATA_PATH)) \
90+
go get github.com/kunalkushwaha/ltag
91+
8192
tools/firecracker-builder-stamp: tools/docker/Dockerfile
8293
docker build \
8394
-t localhost/$(FIRECRACKER_BUILDER_NAME):$(DOCKER_IMAGE_TAG) \
@@ -112,4 +123,8 @@ firecracker-clean:
112123
cargo clean
113124
- rm $(FIRECRACKER_BIN) $(JAILER_BIN)
114125

126+
lint: deps
127+
gofmt -s -l .
128+
$(FC_TEST_DATA_PATH)/ltag -check -v -t .headers
129+
115130
.PHONY: all generate clean distclean build test unit-tests all-tests check-kvm

benchmark_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
113
package firecracker
214

315
import (

drives.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
113
package firecracker
214

315
import (

drives_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
113
package firecracker
214

315
import (

example_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
113
package firecracker_test
214

315
import (

fctesting/test_writer.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
113
package fctesting
214

315
// TestWriter is used to mock out writing and/or do other things such as

fctesting/utils_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
113
package fctesting
214

315
import (

0 commit comments

Comments
 (0)