Skip to content

Commit

Permalink
fix license headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-c4t authored and evlekht committed Jul 25, 2024
1 parent 98d923e commit 93ef73d
Show file tree
Hide file tree
Showing 251 changed files with 311 additions and 267 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.go_version }}
go-version: '1.22' #camino-license needs go version > 1.21 because of "slices" package
check-latest: true
- name: Run static analysis tests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion api/admin/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion api/admin/service.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion api/common_args_responses.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion api/info/camino_client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package info
Expand Down
2 changes: 1 addition & 1 deletion api/info/camino_service.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package info
Expand Down
2 changes: 1 addition & 1 deletion api/info/camino_service_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package info
Expand Down
2 changes: 1 addition & 1 deletion api/info/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion api/info/service.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion chains/atomic/camino_const.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package atomic
Expand Down
2 changes: 1 addition & 1 deletion codec/camino_codec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package codec
Expand Down
2 changes: 1 addition & 1 deletion codec/camino_registry.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package codec
Expand Down
2 changes: 1 addition & 1 deletion codec/camino_test_codec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package codec
Expand Down
2 changes: 1 addition & 1 deletion codec/linearcodec/camino_codec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package linearcodec
Expand Down
2 changes: 1 addition & 1 deletion codec/linearcodec/camino_codec_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package linearcodec
Expand Down
2 changes: 1 addition & 1 deletion codec/reflectcodec/struct_fielder.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023-2024, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion codec/reflectcodec/type_codec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion config/camino.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package config
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion config/flags.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion config/keys.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion database/camino_helpers.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package database
Expand Down
2 changes: 1 addition & 1 deletion database/linkeddb/linkeddb.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion genesis/bootstrappers_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2024, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion genesis/camino_config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis
Expand Down
2 changes: 1 addition & 1 deletion genesis/camino_config_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis
Expand Down
2 changes: 1 addition & 1 deletion genesis/camino_genesis.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis
Expand Down
2 changes: 1 addition & 1 deletion genesis/camino_genesis_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis
Expand Down
2 changes: 1 addition & 1 deletion genesis/camino_unparsed_config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis
Expand Down
2 changes: 1 addition & 1 deletion genesis/camino_unparsed_config_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis
Expand Down
2 changes: 1 addition & 1 deletion genesis/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_camino.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_columbus.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package genesis
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_kopernikus.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

// PrivateKey-vmRQiZeXEXYMyJhEiqdC2z5JhuDbxL8ix9UVvjgMu2Er1NepE => X-kopernikus1g65uqn6t77p656w64023nh8nd9updzmxh8ttv3
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_local.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion genesis/genesis_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion genesis/params.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion genesis/unparsed_config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
34 changes: 34 additions & 0 deletions header.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
default-headers:
- name: avax
header: |
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
- name: avax-c4t
header: |
// Copyright (C) 2022-{YEAR}, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
custom-headers:
- name: c4t
header: |
// Copyright (C) 2022-{YEAR}, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.
include-paths:
- "./**/camino*.go"
- "./genesis/genesis_camino.go"
- "./genesis/genesis_columbus.go"
- "./genesis/genesis_kopernikus.go"
- "./tools/**/*.go"

2 changes: 1 addition & 1 deletion network/certs_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion network/network.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion network/peer/peer_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion network/peer/upgrader.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion node/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023-2024, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
39 changes: 13 additions & 26 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,20 @@ function test_golangci_lint {
golangci-lint run --config .golangci.yml
}

# find_go_files [package]
# all go files except generated ones
function find_go_files {
local target="${1}"
go fmt -n "${target}" | grep -Eo "([^ ]*)$" | grep -vE "(\\.pb\\.go|\\.pb\\.gw.go)"
}

# automatically checks license headers
# to modify the file headers (if missing), remove "--check" flag
# TESTS='license_header' ADDLICENSE_FLAGS="-v" ./scripts/lint.sh
# _addlicense_flags=${ADDLICENSE_FLAGS:-"--check -v"}
# function _test_license_header {
# go install -v github.com/google/addlicense@latest
# local target="${1}"
# local files=()
# while IFS= read -r line; do files+=("$line"); done < <(find_go_files "${target}")

# # ignore 3rd party code
# addlicense \
# -f ./LICENSE.header \
# "${_addlicense_flags}" \
# --ignore 'utils/ip_test.go' \
# --ignore 'utils/logging/highlight.go' \
# --ignore 'utils/ulimit/ulimit_non_unix.go.go' \
# --ignore 'utils/ulimit/ulimit_unix.go' \
# "${files[@]}"
# }
# to modify the file headers (if missing), remove "--verify" flag
# TESTS='license_header' ./scripts/lint.sh
function test_license_header {
go install -v github.com/chain4travel/[email protected]
# TODO: use directory instead of files and do these exclusions from camino-license configuration
local files=()
while IFS= read -r line; do files+=("$line"); done < <(find . -type f -name '*.go' ! -name '*.pb.go' ! -name 'mock_*.go' ! -name 'camino_mock_*.go' | grep -v '^./tools/camino-network-runner/')

# shellcheck disable=SC2086
camino-license check\
--config=./header.yaml \
"${files[@]}"
}

function test_single_import {
if grep -R -zo -P --exclude-dir='camino-network-runner' 'import \(\n\t".*"\n\)' .; then
Expand Down
2 changes: 1 addition & 1 deletion staking/tls.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/p/staking_rewards.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2024, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/static-handlers/suites.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/x/transfer/virtuous.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion tools/cert/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package main
Expand Down
2 changes: 1 addition & 1 deletion tools/genesis/genesis.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
// See the file LICENSE for licensing terms.

package main
Expand Down
Loading

0 comments on commit 93ef73d

Please sign in to comment.