github.com/klaytn/klaytn@v1.10.2/build/update-license.go (about)

     1  // Modifications Copyright 2019 The klaytn Authors
     2  // Copyright 2018 The go-ethereum Authors
     3  // This file is part of the go-ethereum library.
     4  //
     5  // The go-ethereum library is free software: you can redistribute it and/or modify
     6  // it under the terms of the GNU Lesser General Public License as published by
     7  // the Free Software Foundation, either version 3 of the License, or
     8  // (at your option) any later version.
     9  //
    10  // The go-ethereum library is distributed in the hope that it will be useful,
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13  // GNU Lesser General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU Lesser General Public License
    16  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    17  //
    18  // This file is derived from build/update-license.go (2018/06/04).
    19  // Modified and improved for the klaytn development.
    20  
    21  //go:build none
    22  // +build none
    23  
    24  /*
    25  This command generates GPL license headers on top of all source files.
    26  You can run it once per month, before cutting a release or just
    27  whenever you feel like it.
    28  
    29  	go run update-license.go
    30  
    31  All authors (people who have contributed code) are listed in the
    32  AUTHORS file. The author names are mapped and deduplicated using the
    33  .mailmap file. You can use .mailmap to set the canonical name and
    34  address for each author. See git-shortlog(1) for an explanation of the
    35  .mailmap format.
    36  
    37  Please review the resulting diff to check whether the correct
    38  copyright assignments are performed.
    39  */
    40  
    41  package main
    42  
    43  import (
    44  	"bufio"
    45  	"bytes"
    46  	"fmt"
    47  	"io/ioutil"
    48  	"log"
    49  	"os"
    50  	"os/exec"
    51  	"path/filepath"
    52  	"regexp"
    53  	"runtime"
    54  	"sort"
    55  	"strconv"
    56  	"strings"
    57  	"sync"
    58  	"text/template"
    59  	"time"
    60  )
    61  
    62  var (
    63  	// only files with these extensions will be considered
    64  	extensions = []string{".go", ".js", ".qml"}
    65  
    66  	// paths with any of these prefixes will be skipped
    67  	skipPrefixes = []string{
    68  		// boring stuff
    69  		"vendor/", "tests/testdata/", "build/",
    70  		// don't relicense vendored sources
    71  		"cmd/internal/browser",
    72  		"cmd/homi",
    73  		"consensus/ethash/xor.go",
    74  		"crypto/bn256/",
    75  		"crypto/ecies/",
    76  		"crypto/secp256k1",
    77  		//"crypto/secp256k1/curve.go",
    78  		"crypto/sha3/",
    79  		"console/jsre/deps",
    80  		//"log/",
    81  		"common/bitutil/bitutil",
    82  		// don't license generated files
    83  		"contracts/chequebook/contract/code.go",
    84  		"log/term",
    85  		"node/cn/tracers",
    86  		"metrics/exp",
    87  		"metrics/influxdb",
    88  		"metrics/librato",
    89  	}
    90  
    91  	skipSuffixes = []string{
    92  		"doc.go",
    93  	}
    94  
    95  	externalLicencePrefixes = []string{
    96  		"log", "metrics",
    97  	}
    98  
    99  	// paths with this prefix are licensed as GPL. all other files are LGPL.
   100  	gplPrefixes = []string{"cmd/"}
   101  
   102  	// this regexp must match the entire license comment at the
   103  	// beginning of each file.
   104  	ethereumLicenseCommentRE   = regexp.MustCompile(`//\s*(Copyright .* (The go-ethereum|AMIS Technologies)).*?\n(?://.*?\n)*//.*>\.`)
   105  	klaytnLicenseCommentRE     = regexp.MustCompile(`//\s*(Copyright .* The klaytn).*?\n(?://.*?\n)?// This file is part of the klaytn library.*\n(?://.*?\n)*//.*>\.`)
   106  	mixedLicenseCommentRE      = regexp.MustCompile(`//\s*(.*Copyright .* The klaytn).*?\n//\s*(Copyright .* (The go-ethereum|AMIS Technologies)).*?\n(?://.*?\n)*//.*klaytn development\.`)
   107  	externalLicenceCommentRE   = regexp.MustCompile(`//\s*(Copyright .* The klaytn).*?\n(?://.*?\n)*//.*See LICENSE in the top directory for the original copyright and license\.`)
   108  	externalGoLicenceCommentRE = regexp.MustCompile(`//\s*(Copyright .* The Go Authors).*?\n(?://.*?\n)*//.*license that can be found in the LICENSE file\.`)
   109  
   110  	// this text appears at the start of AUTHORS
   111  	authorsFileHeader = "# This is the official list of go-ethereum authors for copyright purposes.\n\n"
   112  
   113  	// ethereumDir is original path referenced by klaytn
   114  	ethereumDir = map[string]string{
   115  		"metrics/meter.go":                                   "metrics/meter.go",
   116  		"metrics/log.go":                                     "metrics/log.go",
   117  		"metrics/runtime_cgo.go":                             "metrics/runtime_cgo.go",
   118  		"metrics/counter_test.go":                            "metrics/counter_test.go",
   119  		"metrics/histogram_test.go":                          "metrics/histogram_test.go",
   120  		"metrics/sample_test.go":                             "metrics/sample_test.go",
   121  		"metrics/metrics.go":                                 "metrics/metrics.go",
   122  		"metrics/gauge.go":                                   "metrics/gauge.go",
   123  		"metrics/disk.go":                                    "metrics/disk.go",
   124  		"metrics/writer_test.go":                             "metrics/writer_test.go",
   125  		"metrics/gauge_float64.go":                           "metrics/gauge_float64.go",
   126  		"metrics/healthcheck.go":                             "metrics/healthcheck.go",
   127  		"metrics/runtime.go":                                 "metrics/runtime.go",
   128  		"metrics/init_test.go":                               "metrics/init_test.go",
   129  		"metrics/metrics_test.go":                            "metrics/metrics_test.go",
   130  		"metrics/resetting_timer.go":                         "metrics/resetting_timer.go",
   131  		"metrics/opentsdb_test.go":                           "metrics/opentsdb_test.go",
   132  		"metrics/graphite.go":                                "metrics/graphite.go",
   133  		"metrics/graphite_test.go":                           "metrics/graphite_test.go",
   134  		"metrics/ewma_test.go":                               "metrics/ewma_test.go",
   135  		"metrics/timer.go":                                   "metrics/timer.go",
   136  		"metrics/registry.go":                                "metrics/registry.go",
   137  		"metrics/histogram.go":                               "metrics/histogram.go",
   138  		"metrics/timer_test.go":                              "metrics/timer_test.go",
   139  		"metrics/runtime_no_gccpufraction.go":                "metrics/runtime_no_gccpufraction.go",
   140  		"metrics/librato/client.go":                          "metrics/librato/client.go",
   141  		"metrics/librato/librato.go":                         "metrics/librato/librato.go",
   142  		"metrics/influxdb/influxdb.go":                       "metrics/influxdb/influxdb.go",
   143  		"metrics/json_test.go":                               "metrics/json_test.go",
   144  		"metrics/writer.go":                                  "metrics/writer.go",
   145  		"metrics/sample.go":                                  "metrics/sample.go",
   146  		"metrics/ewma.go":                                    "metrics/ewma.go",
   147  		"metrics/syslog.go":                                  "metrics/syslog.go",
   148  		"metrics/debug.go":                                   "metrics/debug.go",
   149  		"metrics/runtime_gccpufraction.go":                   "metrics/runtime_gccpufraction.go",
   150  		"metrics/gauge_float64_test.go":                      "metrics/gauge_float64_test.go",
   151  		"metrics/registry_test.go":                           "metrics/registry_test.go",
   152  		"metrics/disk_nop.go":                                "metrics/disk_nop.go",
   153  		"metrics/disk_linux.go":                              "metrics/disk_linux.go",
   154  		"metrics/gauge_test.go":                              "metrics/gauge_test.go",
   155  		"metrics/runtime_test.go":                            "metrics/runtime_test.go",
   156  		"metrics/meter_test.go":                              "metrics/meter_test.go",
   157  		"metrics/counter.go":                                 "metrics/counter.go",
   158  		"metrics/exp/exp.go":                                 "metrics/exp/exp.go",
   159  		"metrics/json.go":                                    "metrics/json.go",
   160  		"metrics/resetting_timer_test.go":                    "metrics/resetting_timer_test.go",
   161  		"metrics/runtime_no_cgo.go":                          "metrics/runtime_no_cgo.go",
   162  		"metrics/opentsdb.go":                                "metrics/opentsdb.go",
   163  		"metrics/debug_test.go":                              "metrics/debug_test.go",
   164  		"metrics/prometheus/prometheusmetrics.go":            "metrics/prometheus/prometheusmetrics.go",
   165  		"cmd/kbn/main.go":                                    "cmd/bootnode/main.go",
   166  		"cmd/kbn/node.go":                                    "node/node.go",
   167  		"cmd/kcn/main.go":                                    "cmd/geth/main.go",
   168  		"cmd/ken/main.go":                                    "cmd/geth/main.go",
   169  		"cmd/kpn/main.go":                                    "cmd/geth/main.go",
   170  		"cmd/kscn/main.go":                                   "cmd/geth/main.go",
   171  		"cmd/kspn/main.go":                                   "cmd/geth/main.go",
   172  		"cmd/ksen/main.go":                                   "cmd/geth/main.go",
   173  		"cmd/klay/main.go":                                   "cmd/geth/main.go",
   174  		"cmd/utils/cmd.go":                                   "cmd/utils/cmd.go",
   175  		"cmd/utils/flags.go":                                 "cmd/utils/flags.go",
   176  		"cmd/utils/app.go":                                   "cmd/utils/flags.go",
   177  		"cmd/utils/customflags.go":                           "cmd/utils/customflags.go",
   178  		"cmd/utils/nodecmd/accountcmd.go":                    "cmd/geth/accountcmd.go",
   179  		"cmd/utils/nodecmd/accountcmd_test.go":               "cmd/geth/accountcmd_test.go",
   180  		"cmd/utils/nodecmd/chaincmd.go":                      "cmd/geth/chaincmd.go",
   181  		"cmd/utils/nodecmd/consolecmd.go":                    "cmd/geth/consolecmd.go",
   182  		"cmd/utils/nodecmd/consolecmd_test.go":               "cmd/geth/consolecmd_test.go",
   183  		"cmd/utils/nodecmd/defaultcmd.go":                    "cmd/geth/main.go",
   184  		"cmd/utils/nodecmd/dumpconfigcmd.go":                 "cmd/geth/config.go",
   185  		"cmd/utils/nodecmd/genesis_test.go":                  "cmd/geth/genesis_test.go",
   186  		"cmd/utils/nodecmd/flags_test.go":                    "cmd/geth/genesis_test.go",
   187  		"cmd/utils/nodecmd/nodeflags.go":                     "cmd/geth/main.go",
   188  		"cmd/utils/nodecmd/run_test.go":                      "cmd/geth/run_test.go",
   189  		"cmd/utils/nodecmd/versioncmd.go":                    "cmd/geth/misccmd.go",
   190  		"cmd/utils/testcmd.go":                               "cmd/cmdtest/test_cmd.go",
   191  		"cmd/utils/usage.go":                                 "cmd/geth/usage.go",
   192  		"cmd/p2psim/main.go":                                 "cmd/p2psim/main.go",
   193  		"cmd/abigen/main.go":                                 "cmd/abigen/main.go",
   194  		"cmd/evm/compiler.go":                                "cmd/evm/compiler.go",
   195  		"cmd/evm/runner.go":                                  "cmd/evm/runner.go",
   196  		"cmd/evm/disasm.go":                                  "cmd/evm/disasm.go",
   197  		"cmd/evm/staterunner.go":                             "cmd/evm/staterunner.go",
   198  		"cmd/evm/internal/compiler/compiler.go":              "cmd/evm/internal/compiler/compiler.go",
   199  		"cmd/evm/main.go":                                    "cmd/evm/main.go",
   200  		"cmd/evm/json_logger.go":                             "cmd/evm/json_logger.go",
   201  		"cmd/grpc-contract/internal/impl/contract.go":        "sol2proto/types/grpc/contract.go",
   202  		"cmd/grpc-contract/internal/impl/mapping.go":         "sol2proto/types/grpc/mapping.go",
   203  		"cmd/grpc-contract/internal/impl/method.go":          "sol2proto/types/grpc/types.go",
   204  		"cmd/grpc-contract/main.go":                          "sol2proto/types/main.go",
   205  		"consensus/istanbul/config.go":                       "quorum/consensus/istanbul/config.go",
   206  		"consensus/istanbul/backend.go":                      "quorum/consensus/istanbul/backend.go",
   207  		"consensus/istanbul/core/handler.go":                 "quorum/consensus/istanbul/core/handler.go",
   208  		"consensus/istanbul/core/backlog.go":                 "quorum/consensus/istanbul/core/backlog.go",
   209  		"consensus/istanbul/core/types.go":                   "quorum/consensus/istanbul/core/types.go",
   210  		"consensus/istanbul/core/preprepare.go":              "quorum/consensus/istanbul/core/preprepare.go",
   211  		"consensus/istanbul/core/core.go":                    "quorum/consensus/istanbul/core/core.go",
   212  		"consensus/istanbul/core/request.go":                 "quorum/consensus/istanbul/core/request.go",
   213  		"consensus/istanbul/core/commit.go":                  "quorum/consensus/istanbul/core/commit.go",
   214  		"consensus/istanbul/core/message_set.go":             "quorum/consensus/istanbul/core/message_set.go",
   215  		"consensus/istanbul/core/events.go":                  "quorum/consensus/istanbul/core/events.go",
   216  		"consensus/istanbul/core/final_committed.go":         "quorum/consensus/istanbul/core/final_committed.go",
   217  		"consensus/istanbul/core/roundstate.go":              "quorum/consensus/istanbul/core/roundstate.go",
   218  		"consensus/istanbul/core/prepare.go":                 "quorum/consensus/istanbul/core/prepare.go",
   219  		"consensus/istanbul/core/errors.go":                  "quorum/consensus/istanbul/core/errors.go",
   220  		"consensus/istanbul/core/roundchange.go":             "quorum/consensus/istanbul/core/roundchange.go",
   221  		"consensus/istanbul/validator/validator.go":          "quorum/consensus/istanbul/validator/validator.go",
   222  		"consensus/istanbul/validator/default_test.go":       "quorum/consensus/istanbul/validator/default_test.go",
   223  		"consensus/istanbul/validator/default.go":            "quorum/consensus/istanbul/validator/default.go",
   224  		"consensus/istanbul/validator/weighted.go":           "quorum/consensus/istanbul/validator/default.go",
   225  		"consensus/istanbul/validator.go":                    "quorum/consensus/istanbul/validator.go",
   226  		"consensus/istanbul/types.go":                        "quorum/consensus/istanbul/types.go",
   227  		"consensus/istanbul/backend/handler.go":              "quorum/consensus/istanbul/backend/handler.go",
   228  		"consensus/istanbul/backend/backend.go":              "quorum/consensus/istanbul/backend/backend.go",
   229  		"consensus/istanbul/backend/engine.go":               "quorum/consensus/istanbul/backend/engine.go",
   230  		"consensus/istanbul/backend/api.go":                  "quorum/consensus/istanbul/backend/api.go",
   231  		"consensus/istanbul/backend/snapshot.go":             "quorum/consensus/istanbul/backend/snapshot.go",
   232  		"consensus/istanbul/events.go":                       "quorum/consensus/istanbul/events.go",
   233  		"consensus/istanbul/utils.go":                        "quorum/consensus/istanbul/utils.go",
   234  		"consensus/istanbul/errors.go":                       "quorum/consensus/istanbul/errors.go",
   235  		"consensus/protocol.go":                              "quorum/consensus/protocol.go",
   236  		"consensus/consensus.go":                             "consensus/consensus.go",
   237  		"consensus/gxhash/sealer.go":                         "consensus/ethash/sealer.go",
   238  		"consensus/gxhash/algorithm.go":                      "consensus/ethash/algorithm.go",
   239  		"consensus/gxhash/gxhash_test.go":                    "consensus/ethash/ethash_test.go",
   240  		"consensus/gxhash/consensus.go":                      "consensus/ethash/consensus.go",
   241  		"consensus/gxhash/algorithm_test.go":                 "consensus/ethash/algorithm_test.go",
   242  		"consensus/gxhash/gxhash.go":                         "consensus/ethash/ethash.go",
   243  		"consensus/gxhash/consensus_test.go":                 "consensus/ethash/consensus_test.go",
   244  		"consensus/clique/api.go":                            "go-ethereum/consensus/clique/api.go",
   245  		"consensus/clique/clique.go":                         "go-ethereum/consensus/clique/clique.go",
   246  		"consensus/clique/snapshot.go":                       "go-ethereum/consensus/clique/snapshot.go",
   247  		"crypto/signature_cgo.go":                            "crypto/signature_cgo.go",
   248  		"crypto/sha3/register.go":                            "crypto/sha3/register.go",
   249  		"crypto/sha3/xor_unaligned.go":                       "crypto/sha3/xor_unaligned.go",
   250  		"crypto/sha3/sha3_test.go":                           "crypto/sha3/sha3_test.go",
   251  		"crypto/sha3/xor_generic.go":                         "crypto/sha3/xor_generic.go",
   252  		"crypto/sha3/shake.go":                               "crypto/sha3/shake.go",
   253  		"crypto/sha3/keccakf_amd64.go":                       "crypto/sha3/keccakf_amd64.go",
   254  		"crypto/sha3/xor.go":                                 "crypto/sha3/xor.go",
   255  		"crypto/sha3/doc.go":                                 "crypto/sha3/doc.go",
   256  		"crypto/sha3/sha3.go":                                "crypto/sha3/sha3.go",
   257  		"crypto/sha3/keccakf.go":                             "crypto/sha3/keccakf.go",
   258  		"crypto/sha3/hashes.go":                              "crypto/sha3/hashes.go",
   259  		"crypto/ecies/params.go":                             "crypto/ecies/params.go",
   260  		"crypto/ecies/ecies_test.go":                         "crypto/ecies/ecies_test.go",
   261  		"crypto/ecies/ecies.go":                              "crypto/ecies/ecies.go",
   262  		"crypto/secp256k1/curve.go":                          "crypto/secp256k1/curve.go",
   263  		"crypto/secp256k1/panic_cb.go":                       "crypto/secp256k1/panic_cb.go",
   264  		"crypto/secp256k1/secp256.go":                        "crypto/secp256k1/secp256.go",
   265  		"crypto/secp256k1/secp256_test.go":                   "crypto/secp256k1/secp256_test.go",
   266  		"crypto/bn256/bn256_fast.go":                         "crypto/bn256/bn256_fast.go",
   267  		"crypto/bn256/google/optate.go":                      "crypto/bn256/google/optate.go",
   268  		"crypto/bn256/google/example_test.go":                "crypto/bn256/google/example_test.go",
   269  		"crypto/bn256/google/bn256_test.go":                  "crypto/bn256/google/bn256_test.go",
   270  		"crypto/bn256/google/twist.go":                       "crypto/bn256/google/twist.go",
   271  		"crypto/bn256/google/constants.go":                   "crypto/bn256/google/constants.go",
   272  		"crypto/bn256/google/curve.go":                       "crypto/bn256/google/curve.go",
   273  		"crypto/bn256/google/gfp2.go":                        "crypto/bn256/google/gfp2.go",
   274  		"crypto/bn256/google/gfp6.go":                        "crypto/bn256/google/gfp6.go",
   275  		"crypto/bn256/google/bn256.go":                       "crypto/bn256/google/bn256.go",
   276  		"crypto/bn256/google/gfp12.go":                       "crypto/bn256/google/gfp12.go",
   277  		"crypto/bn256/google/main_test.go":                   "crypto/bn256/google/main_test.go",
   278  		"crypto/bn256/cloudflare/optate.go":                  "crypto/bn256/cloudflare/optate.go",
   279  		"crypto/bn256/cloudflare/gfp_amd64.s":                "crypto/bn256/cloudflare/gfp_amd64.s",
   280  		"crypto/bn256/cloudflare/gfp_decl.go":                "crypto/bn256/cloudflare/gfp_decl.go",
   281  		"crypto/bn256/cloudflare/example_test.go":            "crypto/bn256/cloudflare/example_test.go",
   282  		"crypto/bn256/cloudflare/gfp_generic.go":             "crypto/bn256/cloudflare/gfp_generic.go",
   283  		"crypto/bn256/cloudflare/bn256_test.go":              "crypto/bn256/cloudflare/bn256_test.go",
   284  		"crypto/bn256/cloudflare/twist.go":                   "crypto/bn256/cloudflare/twist.go",
   285  		"crypto/bn256/cloudflare/constants.go":               "crypto/bn256/cloudflare/constants.go",
   286  		"crypto/bn256/cloudflare/lattice.go":                 "crypto/bn256/cloudflare/lattice.go",
   287  		"crypto/bn256/cloudflare/gfp_test.go":                "crypto/bn256/cloudflare/gfp_test.go",
   288  		"crypto/bn256/cloudflare/curve.go":                   "crypto/bn256/cloudflare/curve.go",
   289  		"crypto/bn256/cloudflare/gfp2.go":                    "crypto/bn256/cloudflare/gfp2.go",
   290  		"crypto/bn256/cloudflare/gfp.go":                     "crypto/bn256/cloudflare/gfp.go",
   291  		"crypto/bn256/cloudflare/gfp6.go":                    "crypto/bn256/cloudflare/gfp6.go",
   292  		"crypto/bn256/cloudflare/lattice_test.go":            "crypto/bn256/cloudflare/lattice_test.go",
   293  		"crypto/bn256/cloudflare/bn256.go":                   "crypto/bn256/cloudflare/bn256.go",
   294  		"crypto/bn256/cloudflare/gfp12.go":                   "crypto/bn256/cloudflare/gfp12.go",
   295  		"crypto/bn256/cloudflare/main_test.go":               "crypto/bn256/cloudflare/main_test.go",
   296  		"crypto/bn256/bn256_fuzz.go":                         "crypto/bn256/bn256_fuzz.go",
   297  		"crypto/bn256/bn256_slow.go":                         "crypto/bn256/bn256_slow.go",
   298  		"crypto/signature_test.go":                           "crypto/signature_test.go",
   299  		"crypto/crypto.go":                                   "crypto/crypto.go",
   300  		"crypto/crypto_test.go":                              "crypto/crypto_test.go",
   301  		"datasync/fetcher/metrics.go":                        "eth/fetcher/metrics.go",
   302  		"datasync/fetcher/fetcher_test.go":                   "eth/fetcher/fetcher_test.go",
   303  		"datasync/fetcher/fetcher.go":                        "eth/fetcher/fetcher.go",
   304  		"datasync/downloader/downloader.go":                  "eth/downloader/downloader.go",
   305  		"datasync/downloader/metrics.go":                     "eth/downloader/metrics.go",
   306  		"datasync/downloader/queue.go":                       "eth/downloader/queue.go",
   307  		"datasync/downloader/modes.go":                       "eth/downloader/modes.go",
   308  		"datasync/downloader/types.go":                       "eth/downloader/types.go",
   309  		"datasync/downloader/downloader_test.go":             "eth/downloader/downloader_test.go",
   310  		"datasync/downloader/events.go":                      "eth/downloader/events.go",
   311  		"datasync/downloader/testchain_test.go":              "eth/downloader/testchain_test.go",
   312  		"datasync/downloader/api.go":                         "eth/downloader/api.go",
   313  		"datasync/downloader/peer.go":                        "eth/downloader/peer.go",
   314  		"datasync/downloader/statesync.go":                   "eth/downloader/statesync.go",
   315  		"interfaces.go":                                      "interfaces.go",
   316  		"tests/vm_test_util.go":                              "tests/vm_test_util.go",
   317  		"tests/gen_stenv.go":                                 "tests/gen_stenv.go",
   318  		"tests/gen_tttransaction.go":                         "tests/gen_tttransaction.go",
   319  		"tests/gen_btheader.go":                              "tests/gen_btheader.go",
   320  		"tests/state_test_util.go":                           "tests/state_test_util.go",
   321  		"tests/gen_sttransaction.go":                         "tests/gen_sttransaction.go",
   322  		"tests/transaction_test.go":                          "tests/transaction_test.go",
   323  		"tests/init_test.go":                                 "tests/init_test.go",
   324  		"tests/gen_vmexec.go":                                "tests/gen_vmexec.go",
   325  		"tests/block_test.go":                                "tests/block_test.go",
   326  		"tests/transaction_test_util.go":                     "tests/transaction_test_util.go",
   327  		"tests/state_test.go":                                "tests/state_test.go",
   328  		"tests/rlp_test.go":                                  "tests/rlp_test.go",
   329  		"tests/vm_test.go":                                   "tests/vm_test.go",
   330  		"tests/block_test_util.go":                           "tests/block_test_util.go",
   331  		"tests/rlp_test_util.go":                             "tests/rlp_test_util.go",
   332  		"tests/init.go":                                      "tests/init.go",
   333  		"utils/build/env.go":                                 "internal/build/env.go",
   334  		"utils/build/pgp.go":                                 "internal/build/pgp.go",
   335  		"utils/build/util.go":                                "internal/build/util.go",
   336  		"utils/build/archive.go":                             "internal/build/archive.go",
   337  		"storage/database/leveldb_database.go":               "ethdb/database.go",
   338  		"storage/database/interface.go":                      "ethdb/interface.go",
   339  		"storage/database/database_test.go":                  "ethdb/database_test.go",
   340  		"storage/database/memory_database.go":                "ethdb/memory_database.go",
   341  		"storage/database/schema.go":                         "core/rawdb/schema.go",
   342  		"storage/statedb/encoding.go":                        "trie/encoding.go",
   343  		"storage/statedb/secure_trie.go":                     "trie/secure_trie.go",
   344  		"storage/statedb/derive_sha.go":                      "core/types/derive_sha.go",
   345  		"storage/statedb/sync.go":                            "trie/sync.go",
   346  		"storage/statedb/sync_test.go":                       "trie/sync_test.go",
   347  		"storage/statedb/proof_test.go":                      "trie/proof_test.go",
   348  		"storage/statedb/database.go":                        "trie/database.go",
   349  		"storage/statedb/iterator_test.go":                   "trie/iterator_test.go",
   350  		"storage/statedb/encoding_test.go":                   "trie/encoding_test.go",
   351  		"storage/statedb/proof.go":                           "trie/proof.go",
   352  		"storage/statedb/iterator.go":                        "trie/iterator.go",
   353  		"storage/statedb/node_test.go":                       "trie/node_test.go",
   354  		"storage/statedb/secure_trie_test.go":                "trie/secure_trie_test.go",
   355  		"storage/statedb/trie.go":                            "trie/trie.go",
   356  		"storage/statedb/trie_test.go":                       "trie/trie_test.go",
   357  		"storage/statedb/hasher.go":                          "trie/hasher.go",
   358  		"storage/statedb/node.go":                            "trie/node.go",
   359  		"storage/statedb/errors.go":                          "trie/errors.go",
   360  		"blockchain/genesis_test.go":                         "core/genesis_test.go",
   361  		"blockchain/helper_test.go":                          "core/helper_test.go",
   362  		"blockchain/error.go":                                "core/error.go",
   363  		"blockchain/tx_list_test.go":                         "core/tx_list_test.go",
   364  		"blockchain/evm.go":                                  "core/evm.go",
   365  		"blockchain/state_processor.go":                      "core/state_processor.go",
   366  		"blockchain/types/log.go":                            "core/types/log.go",
   367  		"blockchain/types/transaction_signing.go":            "core/types/transaction_signing.go",
   368  		"blockchain/types/gen_header_json.go":                "core/types/gen_header_json.go",
   369  		"blockchain/types/derive_sha.go":                     "core/types/derive_sha.go",
   370  		"blockchain/types/transaction_test.go":               "core/types/transaction_test.go",
   371  		"blockchain/types/log_test.go":                       "core/types/log_test.go",
   372  		"blockchain/types/block_test.go":                     "core/types/block_test.go",
   373  		"blockchain/types/gen_log_json.go":                   "core/types/gen_log_json.go",
   374  		"blockchain/types/transaction.go":                    "core/types/transaction.go",
   375  		"blockchain/types/receipt.go":                        "core/types/receipt.go",
   376  		"blockchain/types/bloom_test.go":                     "core/types/bloom9_test.go",
   377  		"blockchain/types/gen_tx_json.go":                    "core/types/gen_tx_json.go",
   378  		"blockchain/types/transaction_signing_test.go":       "core/types/transaction_signing_test.go",
   379  		"blockchain/types/bloom.go":                          "core/types/bloom9.go",
   380  		"blockchain/types/gen_receipt_json.go":               "core/types/gen_receipt_json.go",
   381  		"blockchain/types/block.go":                          "core/types/block.go",
   382  		"blockchain/types/contract_ref.go":                   "core/state_transition.go",
   383  		"blockchain/asm/compiler.go":                         "core/asm/compiler.go",
   384  		"blockchain/asm/lex_test.go":                         "core/asm/lex_test.go",
   385  		"blockchain/asm/lexer.go":                            "core/asm/lexer.go",
   386  		"blockchain/asm/asm_test.go":                         "core/asm/asm_test.go",
   387  		"blockchain/asm/asm.go":                              "core/asm/asm.go",
   388  		"blockchain/asm/doc.go":                              "core/asm/asm.go",
   389  		"blockchain/state_transition.go":                     "core/state_transition.go",
   390  		"blockchain/chain_makers.go":                         "core/chain_makers.go",
   391  		"blockchain/tx_pool_test.go":                         "core/tx_pool_test.go",
   392  		"blockchain/metrics.go":                              "eth/metrics.go",
   393  		"blockchain/block_validator_test.go":                 "core/block_validator_test.go",
   394  		"blockchain/tx_journal.go":                           "core/tx_journal.go",
   395  		"blockchain/genesis_alloc.go":                        "core/genesis_alloc.go",
   396  		"blockchain/chain_indexer_test.go":                   "core/chain_indexer_test.go",
   397  		"blockchain/types.go":                                "core/types.go",
   398  		"blockchain/bad_blocks.go":                           "core/blocks.go",
   399  		"blockchain/tx_list.go":                              "core/tx_list.go",
   400  		"blockchain/gen_genesis_account.go":                  "core/gen_genesis_account.go",
   401  		"blockchain/events.go":                               "core/events.go",
   402  		"blockchain/gaspool.go":                              "core/gaspool.go",
   403  		"blockchain/state/managed_state_test.go":             "core/state/managed_state_test.go",
   404  		"blockchain/state/journal.go":                        "core/state/journal.go",
   405  		"blockchain/state/statedb_test.go":                   "core/state/statedb_test.go",
   406  		"blockchain/state/sync.go":                           "core/state/sync.go",
   407  		"blockchain/state/managed_state.go":                  "core/state/managed_state.go",
   408  		"blockchain/state/database.go":                       "core/state/database.go",
   409  		"blockchain/state/state_object.go":                   "core/state/state_object.go",
   410  		"blockchain/state/state_test.go":                     "core/state/state_test.go",
   411  		"blockchain/state/dump.go":                           "core/state/dump.go",
   412  		"blockchain/state/main_test.go":                      "core/state/main_test.go",
   413  		"blockchain/state/statedb.go":                        "core/state/statedb.go",
   414  		"blockchain/bloombits/scheduler_test.go":             "core/bloombits/scheduler_test.go",
   415  		"blockchain/bloombits/matcher.go":                    "core/bloombits/matcher.go",
   416  		"blockchain/bloombits/generator.go":                  "core/bloombits/generator.go",
   417  		"blockchain/bloombits/matcher_test.go":               "core/bloombits/matcher_test.go",
   418  		"blockchain/bloombits/generator_test.go":             "core/bloombits/generator_test.go",
   419  		"blockchain/bloombits/scheduler.go":                  "core/bloombits/scheduler.go",
   420  		"blockchain/blockchain.go":                           "core/blockchain.go",
   421  		"blockchain/vm/memory.go":                            "core/vm/memory.go",
   422  		"blockchain/vm/opcodes.go":                           "core/vm/opcodes.go",
   423  		"blockchain/vm/analysis.go":                          "core/vm/analysis.go",
   424  		"blockchain/vm/gas_table_test.go":                    "core/vm/gas_table_test.go",
   425  		"blockchain/vm/gas_table.go":                         "core/vm/gas_table.go",
   426  		"blockchain/vm/evm.go":                               "core/vm/evm.go",
   427  		"blockchain/vm/gas.go":                               "core/vm/gas.go",
   428  		"blockchain/vm/intpool_test.go":                      "core/vm/intpool_test.go",
   429  		"blockchain/vm/logger.go":                            "core/vm/logger.go",
   430  		"blockchain/vm/int_pool_verifier_empty.go":           "core/vm/int_pool_verifier_empty.go",
   431  		"blockchain/vm/runtime/env.go":                       "core/vm/runtime/env.go",
   432  		"blockchain/vm/runtime/runtime.go":                   "core/vm/runtime/runtime.go",
   433  		"blockchain/vm/runtime/runtime_example_test.go":      "core/vm/runtime/runtime_example_test.go",
   434  		"blockchain/vm/runtime/doc.go":                       "core/vm/runtime/doc.go",
   435  		"blockchain/vm/runtime/runtime_test.go":              "core/vm/runtime/runtime_test.go",
   436  		"blockchain/vm/interface.go":                         "core/vm/interface.go",
   437  		"blockchain/vm/analysis_test.go":                     "core/vm/analysis_test.go",
   438  		"blockchain/vm/instructions.go":                      "core/vm/instructions.go",
   439  		"blockchain/vm/gen_structlog.go":                     "core/vm/gen_structlog.go",
   440  		"blockchain/vm/contracts.go":                         "core/vm/contracts.go",
   441  		"blockchain/vm/memory_table.go":                      "core/vm/memory_table.go",
   442  		"blockchain/vm/instructions_test.go":                 "core/vm/instructions_test.go",
   443  		"blockchain/vm/stack.go":                             "core/vm/stack.go",
   444  		"blockchain/vm/common.go":                            "core/vm/common.go",
   445  		"blockchain/vm/stack_table.go":                       "core/vm/stack_table.go",
   446  		"blockchain/vm/interpreter.go":                       "core/vm/interpreter.go",
   447  		"blockchain/vm/intpool.go":                           "core/vm/intpool.go",
   448  		"blockchain/vm/jump_table.go":                        "core/vm/jump_table.go",
   449  		"blockchain/vm/contract.go":                          "core/vm/contract.go",
   450  		"blockchain/vm/contracts_test.go":                    "core/vm/contracts_test.go",
   451  		"blockchain/vm/logger_test.go":                       "core/vm/logger_test.go",
   452  		"blockchain/vm/errors.go":                            "core/vm/errors.go",
   453  		"blockchain/vm/logger_json.go":                       "cmd/evm/json_logger.go",
   454  		"blockchain/blockchain_test.go":                      "core/blockchain_test.go",
   455  		"blockchain/mkalloc.go":                              "core/mkalloc.go",
   456  		"blockchain/headerchain.go":                          "core/headerchain.go",
   457  		"blockchain/chain_indexer.go":                        "core/chain_indexer.go",
   458  		"blockchain/tx_pool.go":                              "core/tx_pool.go",
   459  		"blockchain/block_validator.go":                      "core/block_validator.go",
   460  		"blockchain/bench_test.go":                           "core/bench_test.go",
   461  		"blockchain/genesis.go":                              "core/genesis.go",
   462  		"blockchain/chain_makers_test.go":                    "core/chain_makers_test.go",
   463  		"blockchain/tx_cacher.go":                            "core/tx_cacher.go",
   464  		"blockchain/gen_genesis.go":                          "core/gen_genesis.go",
   465  		"networks/p2p/discover/table_test.go":                "p2p/discover/table_test.go",
   466  		"networks/p2p/discover/ntp.go":                       "p2p/discover/ntp.go",
   467  		"networks/p2p/discover/database.go":                  "p2p/discover/database.go",
   468  		"networks/p2p/discover/udp_test.go":                  "p2p/discover/udp_test.go",
   469  		"networks/p2p/discover/database_test.go":             "p2p/discover/database_test.go",
   470  		"networks/p2p/discover/udp.go":                       "p2p/discover/udp.go",
   471  		"networks/p2p/discover/node_test.go":                 "p2p/discover/node_test.go",
   472  		"networks/p2p/discover/node.go":                      "p2p/discover/node.go",
   473  		"networks/p2p/discover/table.go":                     "p2p/discover/table.go",
   474  		"networks/p2p/discover/discover_storage_kademlia.go": "p2p/discover/table.go",
   475  		"networks/p2p/server.go":                             "p2p/server.go",
   476  		"networks/p2p/metrics.go":                            "p2p/metrics.go",
   477  		"networks/p2p/rlpx_test.go":                          "p2p/rlpx_test.go",
   478  		"networks/p2p/dial_test.go":                          "p2p/dial_test.go",
   479  		"networks/p2p/rlpx.go":                               "p2p/rlpx.go",
   480  		"networks/p2p/nat/natpmp.go":                         "p2p/nat/natpmp.go",
   481  		"networks/p2p/nat/natupnp.go":                        "p2p/nat/natupnp.go",
   482  		"networks/p2p/nat/nat.go":                            "p2p/nat/nat.go",
   483  		"networks/p2p/nat/nat_test.go":                       "p2p/nat/nat_test.go",
   484  		"networks/p2p/nat/natupnp_test.go":                   "p2p/nat/natupnp_test.go",
   485  		"networks/p2p/message.go":                            "p2p/message.go",
   486  		"networks/p2p/protocol.go":                           "p2p/protocol.go",
   487  		"networks/p2p/message_test.go":                       "p2p/message_test.go",
   488  		"networks/p2p/simulations/mocker_test.go":            "p2p/simulations/mocker_test.go",
   489  		"networks/p2p/simulations/simulation.go":             "p2p/simulations/simulation.go",
   490  		"networks/p2p/simulations/http_test.go":              "p2p/simulations/http_test.go",
   491  		"networks/p2p/simulations/network_test.go":           "p2p/simulations/network_test.go",
   492  		"networks/p2p/simulations/mocker.go":                 "p2p/simulations/mocker.go",
   493  		"networks/p2p/simulations/events.go":                 "p2p/simulations/events.go",
   494  		"networks/p2p/simulations/pipes/pipes.go":            "p2p/simulations/pipes/pipes.go",
   495  		"networks/p2p/simulations/adapters/docker.go":        "p2p/simulations/adapters/docker.go",
   496  		"networks/p2p/simulations/adapters/types.go":         "p2p/simulations/adapters/types.go",
   497  		"networks/p2p/simulations/adapters/exec.go":          "p2p/simulations/adapters/exec.go",
   498  		"networks/p2p/simulations/adapters/inproc.go":        "p2p/simulations/adapters/inproc.go",
   499  		"networks/p2p/simulations/adapters/ws.go":            "p2p/simulations/adapters/ws.go",
   500  		"networks/p2p/simulations/adapters/ws_test.go":       "p2p/simulations/adapters/ws_test.go",
   501  		"networks/p2p/simulations/adapters/inproc_test.go":   "p2p/simulations/adapters/inproc_test.go",
   502  		"networks/p2p/simulations/network.go":                "p2p/simulations/network.go",
   503  		"networks/p2p/simulations/http.go":                   "p2p/simulations/http.go",
   504  		"networks/p2p/simulations/examples/ping-pong.go":     "p2p/simulations/examples/ping-pong.go",
   505  		"networks/p2p/peer_error.go":                         "p2p/peer_error.go",
   506  		"networks/p2p/peer.go":                               "p2p/peer.go",
   507  		"networks/p2p/netutil/error.go":                      "p2p/netutil/error.go",
   508  		"networks/p2p/netutil/net.go":                        "p2p/netutil/net.go",
   509  		"networks/p2p/netutil/net_test.go":                   "p2p/netutil/net_test.go",
   510  		"networks/p2p/netutil/toobig_notwindows.go":          "p2p/netutil/toobig_notwindows.go",
   511  		"networks/p2p/netutil/error_test.go":                 "p2p/netutil/error_test.go",
   512  		"networks/p2p/netutil/toobig_windows.go":             "p2p/netutil/toobig_windows.go",
   513  		"networks/p2p/peer_test.go":                          "p2p/peer_test.go",
   514  		"networks/p2p/dial.go":                               "p2p/dial.go",
   515  		"networks/p2p/server_test.go":                        "p2p/server_test.go",
   516  		"networks/rpc/ipc_unix.go":                           "rpc/ipc_unix.go",
   517  		"networks/rpc/ipc_windows.go":                        "rpc/ipc_windows.go",
   518  		"networks/rpc/subscription.go":                       "rpc/subscription.go",
   519  		"networks/rpc/utils_test.go":                         "rpc/utils_test.go",
   520  		"networks/rpc/server.go":                             "rpc/server.go",
   521  		"networks/rpc/http_test.go":                          "rpc/http_test.go",
   522  		"networks/rpc/types_test.go":                         "rpc/types_test.go",
   523  		"networks/rpc/types.go":                              "rpc/types.go",
   524  		"networks/rpc/client.go":                             "rpc/client.go",
   525  		"networks/rpc/ipc.go":                                "rpc/ipc.go",
   526  		"networks/rpc/subscription_test.go":                  "rpc/subscription_test.go",
   527  		"networks/rpc/json_test.go":                          "rpc/json_test.go",
   528  		"networks/rpc/http.go":                               "rpc/http.go",
   529  		"networks/rpc/inproc.go":                             "rpc/inproc.go",
   530  		"networks/rpc/utils.go":                              "rpc/utils.go",
   531  		"networks/rpc/websocket.go":                          "rpc/websocket.go",
   532  		"networks/rpc/client_example_test.go":                "rpc/client_example_test.go",
   533  		"networks/rpc/client_test.go":                        "rpc/client_test.go",
   534  		"networks/rpc/endpoints.go":                          "rpc/endpoints.go",
   535  		"networks/rpc/json.go":                               "rpc/json.go",
   536  		"networks/rpc/server_test.go":                        "rpc/server_test.go",
   537  		"networks/rpc/errors.go":                             "rpc/errors.go",
   538  		"networks/grpc/gClient.go":                           "rpc/json.go",
   539  		"networks/grpc/gServer.go":                           "rpc/http.go",
   540  		"common/mclock/mclock.go":                            "common/mclock/mclock.go",
   541  		"common/hexutil/hexutil.go":                          "common/hexutil/hexutil.go",
   542  		"common/hexutil/hexutil_test.go":                     "common/hexutil/hexutil_test.go",
   543  		"common/hexutil/json_example_test.go":                "common/hexutil/json_example_test.go",
   544  		"common/hexutil/json_test.go":                        "common/hexutil/json_test.go",
   545  		"common/hexutil/json.go":                             "common/hexutil/json.go",
   546  		"common/bitutil/compress_test.go":                    "common/bitutil/compress_test.go",
   547  		"common/bitutil/bitutil_test.go":                     "common/bitutil/bitutil_test.go",
   548  		"common/bitutil/compress.go":                         "common/bitutil/compress.go",
   549  		"common/bitutil/bitutil.go":                          "common/bitutil/bitutil.go",
   550  		"common/size_test.go":                                "common/size_test.go",
   551  		"common/types_test.go":                               "common/types_test.go",
   552  		"common/size.go":                                     "common/size.go",
   553  		"common/types.go":                                    "common/types.go",
   554  		"common/format.go":                                   "common/format.go",
   555  		"common/math/integer_test.go":                        "common/math/integer_test.go",
   556  		"common/math/integer.go":                             "common/math/integer.go",
   557  		"common/math/big.go":                                 "common/math/big.go",
   558  		"common/math/big_test.go":                            "common/math/big_test.go",
   559  		"common/debug.go":                                    "common/debug.go",
   560  		"common/utils.go":                                    "common/test_utils.go",
   561  		"common/fdlimit/fdlimit_test.go":                     "common/fdlimit/fdlimit_test.go",
   562  		"common/fdlimit/fdlimit_unix.go":                     "common/fdlimit/fdlimit_unix.go",
   563  		"common/fdlimit/fdlimit_windows.go":                  "common/fdlimit/fdlimit_windows.go",
   564  		"common/fdlimit/fdlimit_freebsd.go":                  "common/fdlimit/fdlimit_freebsd.go",
   565  		"common/path.go":                                     "common/path.go",
   566  		"common/compiler/solidity.go":                        "common/compiler/solidity.go",
   567  		"common/compiler/solidity_test.go":                   "common/compiler/solidity_test.go",
   568  		"common/bytes.go":                                    "common/bytes.go",
   569  		"common/bytes_test.go":                               "common/bytes_test.go",
   570  		"common/big.go":                                      "common/big.go",
   571  		"common/main_test.go":                                "common/main_test.go",
   572  		"accounts/accounts.go":                               "accounts/accounts.go",
   573  		"accounts/hd.go":                                     "accounts/hd.go",
   574  		"accounts/keystore/watch_fallback.go":                "accounts/keystore/watch_fallback.go",
   575  		"accounts/keystore/account_cache_test.go":            "accounts/keystore/account_cache_test.go",
   576  		"accounts/keystore/presale.go":                       "accounts/keystore/presale.go",
   577  		"accounts/keystore/keystore_passphrase_test.go":      "accounts/keystore/keystore_passphrase_test.go",
   578  		"accounts/keystore/key.go":                           "accounts/keystore/key.go",
   579  		"accounts/keystore/file_cache.go":                    "accounts/keystore/file_cache.go",
   580  		"accounts/keystore/keystore_test.go":                 "accounts/keystore/keystore_test.go",
   581  		"accounts/keystore/keystore_passphrase.go":           "accounts/keystore/keystore_passphrase.go",
   582  		"accounts/keystore/account_cache.go":                 "accounts/keystore/account_cache.go",
   583  		"accounts/keystore/keystore_plain_test.go":           "accounts/keystore/keystore_plain_test.go",
   584  		"accounts/keystore/keystore_plain.go":                "accounts/keystore/keystore_plain.go",
   585  		"accounts/keystore/keystore_wallet.go":               "accounts/keystore/keystore_wallet.go",
   586  		"accounts/keystore/keystore.go":                      "accounts/keystore/keystore.go",
   587  		"accounts/keystore/watch.go":                         "accounts/keystore/watch.go",
   588  		"accounts/abi/error.go":                              "accounts/abi/error.go",
   589  		"accounts/abi/event.go":                              "accounts/abi/event.go",
   590  		"accounts/abi/argument.go":                           "accounts/abi/argument.go",
   591  		"accounts/abi/pack.go":                               "accounts/abi/pack.go",
   592  		"accounts/abi/type.go":                               "accounts/abi/type.go",
   593  		"accounts/abi/numbers.go":                            "accounts/abi/numbers.go",
   594  		"accounts/abi/unpack_test.go":                        "accounts/abi/unpack_test.go",
   595  		"accounts/abi/event_test.go":                         "accounts/abi/event_test.go",
   596  		"accounts/abi/abi.go":                                "accounts/abi/abi.go",
   597  		"accounts/abi/unpack.go":                             "accounts/abi/unpack.go",
   598  		"accounts/abi/method.go":                             "accounts/abi/method.go",
   599  		"accounts/abi/abi_test.go":                           "accounts/abi/abi_test.go",
   600  		"accounts/abi/type_test.go":                          "accounts/abi/type_test.go",
   601  		"accounts/abi/reflect.go":                            "accounts/abi/reflect.go",
   602  		"accounts/abi/bind/backend.go":                       "accounts/abi/bind/backend.go",
   603  		"accounts/abi/bind/auth.go":                          "accounts/abi/bind/auth.go",
   604  		"accounts/abi/bind/util_test.go":                     "accounts/abi/bind/util_test.go",
   605  		"accounts/abi/bind/backends/simulated.go":            "accounts/abi/bind/backends/simulated.go",
   606  		"accounts/abi/bind/bind_test.go":                     "accounts/abi/bind/bind_test.go",
   607  		"accounts/abi/bind/util.go":                          "accounts/abi/bind/util.go",
   608  		"accounts/abi/bind/template.go":                      "accounts/abi/bind/template.go",
   609  		"accounts/abi/bind/topics.go":                        "accounts/abi/bind/topics.go",
   610  		"accounts/abi/bind/bind.go":                          "accounts/abi/bind/bind.go",
   611  		"accounts/abi/bind/base.go":                          "accounts/abi/bind/base.go",
   612  		"accounts/abi/numbers_test.go":                       "accounts/abi/numbers_test.go",
   613  		"accounts/abi/pack_test.go":                          "accounts/abi/pack_test.go",
   614  		"accounts/hd_test.go":                                "accounts/hd_test.go",
   615  		"accounts/url.go":                                    "accounts/url.go",
   616  		"accounts/url_test.go":                               "accounts/url_test.go",
   617  		"accounts/manager.go":                                "accounts/manager.go",
   618  		"accounts/errors.go":                                 "accounts/errors.go",
   619  		"work/worker.go":                                     "miner/worker.go",
   620  		"work/remote_agent.go":                               "miner/remote_agent.go",
   621  		"work/unconfirmed.go":                                "miner/unconfirmed.go",
   622  		"work/agent.go":                                      "miner/agent.go",
   623  		"work/unconfirmed_test.go":                           "miner/unconfirmed_test.go",
   624  		"work/work.go":                                       "miner/miner.go",
   625  		"params/config.go":                                   "params/config.go",
   626  		"params/version.go":                                  "params/version.go",
   627  		"params/gas_table.go":                                "params/gas_table.go",
   628  		"params/denomination.go":                             "params/denomination.go",
   629  		"params/network_params.go":                           "params/network_params.go",
   630  		"params/protocol_params.go":                          "params/protocol_params.go",
   631  		"params/computation_cost_params.go":                  "params/protocol_params.go",
   632  		"params/bootnodes.go":                                "params/bootnodes.go",
   633  		"api/backend.go":                                     "internal/ethapi/backend.go",
   634  		"api/addrlock.go":                                    "internal/ethapi/addrlock.go",
   635  		"api/api_private_account.go":                         "internal/ethapi/api.go",
   636  		"api/api_private_debug.go":                           "internal/ethapi/api.go",
   637  		"api/api_public_account.go":                          "internal/ethapi/api.go",
   638  		"api/api_public_blockchain.go":                       "internal/ethapi/api.go",
   639  		"api/api_public_cypress.go":                          "internal/ethapi/api.go",
   640  		"api/api_public_debug.go":                            "internal/ethapi/api.go",
   641  		"api/api_public_klay.go":                             "internal/ethapi/api.go",
   642  		"api/api_public_net.go":                              "internal/ethapi/api.go",
   643  		"api/api_public_transaction_pool.go":                 "internal/ethapi/api.go",
   644  		"api/api_public_tx_pool.go":                          "internal/ethapi/api.go",
   645  		"api/debug/trace.go":                                 "internal/debug/trace.go",
   646  		"api/debug/flags.go":                                 "internal/debug/flags.go",
   647  		"api/debug/loudpanic_fallback.go":                    "internal/debug/loudpanic_fallback.go",
   648  		"api/debug/loudpanic.go":                             "internal/debug/loudpanic.go",
   649  		"api/debug/api.go":                                   "internal/debug/api.go",
   650  		"api/debug/trace_fallback.go":                        "internal/debug/trace_fallback.go",
   651  		"log/handler.go":                                     "log/handler.go",
   652  		"log/handler_glog.go":                                "log/handler_glog.go",
   653  		"log/handler_go13.go":                                "log/handler_go13.go",
   654  		"log/handler_go14.go":                                "log/handler_go14.go",
   655  		"log/log15_logger.go":                                "log/logger.go",
   656  		"log/format.go":                                      "log/format.go",
   657  		"log/handler_syslog.go":                              "log/syslog.go",
   658  		"log/term/terminal_openbsd.go":                       "log/term/terminal_openbsd.go",
   659  		"log/term/terminal_freebsd.go":                       "log/term/terminal_freebsd.go",
   660  		"log/term/terminal_linux.go":                         "log/term/terminal_linux.go",
   661  		"log/term/terminal_appengine.go":                     "log/term/terminal_appengine.go",
   662  		"log/term/terminal_netbsd.go":                        "log/term/terminal_netbsd.go",
   663  		"log/term/terminal_notwindows.go":                    "log/term/terminal_notwindows.go",
   664  		"log/term/terminal_solaris.go":                       "log/term/terminal_solaris.go",
   665  		"log/term/terminal_darwin.go":                        "log/term/terminal_darwin.go",
   666  		"log/term/terminal_windows.go":                       "log/term/terminal_windows.go",
   667  		"ser/rlp/raw.go":                                     "rlp/raw.go",
   668  		"ser/rlp/decode_test.go":                             "rlp/decode_test.go",
   669  		"ser/rlp/encode.go":                                  "rlp/encode.go",
   670  		"ser/rlp/typecache.go":                               "rlp/typecache.go",
   671  		"ser/rlp/raw_test.go":                                "rlp/raw_test.go",
   672  		"ser/rlp/encoder_example_test.go":                    "rlp/encoder_example_test.go",
   673  		"ser/rlp/decode_tail_test.go":                        "rlp/decode_tail_test.go",
   674  		"ser/rlp/decode.go":                                  "rlp/decode.go",
   675  		"ser/rlp/encode_test.go":                             "rlp/encode_test.go",
   676  		"node/config.go":                                     "node/config.go",
   677  		"node/utils_test.go":                                 "node/utils_test.go",
   678  		"node/node_example_test.go":                          "node/node_example_test.go",
   679  		"node/service.go":                                    "node/service.go",
   680  		"node/cn/filters/filter.go":                          "eth/filters/filter.go",
   681  		"node/cn/filters/api.go":                             "eth/filters/api.go",
   682  		"node/cn/filters/filter_system_test.go":              "eth/filters/filter_system_test.go",
   683  		"node/cn/filters/api_test.go":                        "eth/filters/api_test.go",
   684  		"node/cn/filters/filter_system.go":                   "eth/filters/filter_system.go",
   685  		"node/cn/handler.go":                                 "eth/handler.go",
   686  		"node/cn/api_backend.go":                             "eth/api_backend.go",
   687  		"node/cn/api_sc_backend.go":                          "eth/api_backend.go",
   688  		"node/cn/tracers/api.go":                             "eth/tracers/api.go",
   689  		"node/cn/config.go":                                  "eth/config.go",
   690  		"node/cn/backend.go":                                 "eth/backend.go",
   691  		"node/cn/sc_backend.go":                              "eth/backend.go",
   692  		"node/cn/gasprice/gasprice.go":                       "eth/gasprice/gasprice.go",
   693  		"node/cn/metrics.go":                                 "eth/metrics.go",
   694  		"node/cn/sync.go":                                    "eth/sync.go",
   695  		"node/cn/protocol.go":                                "eth/protocol.go",
   696  		"node/cn/gen_config.go":                              "eth/gen_config.go",
   697  		"node/cn/bloombits.go":                               "eth/bloombits.go",
   698  		"node/cn/api.go":                                     "eth/api.go",
   699  		"node/cn/api_sc.go":                                  "eth/api.go",
   700  		"node/cn/peer.go":                                    "eth/peer.go",
   701  		"node/cn/api_test.go":                                "eth/api_test.go",
   702  		"node/sc/bridge_addr_journal.go":                     "core/tx_journal.go",
   703  		"node/sc/sorted_map_list.go":                         "core/tx_list.go",
   704  		"node/sc/bridge_tx_journal.go":                       "core/tx_journal.go",
   705  		"node/sc/bridge_tx_list.go":                          "core/tx_list.go",
   706  		"node/sc/bridge_tx_pool.go":                          "core/tx_pool.go",
   707  		"node/sc/bridgepeer.go":                              "eth/peer.go",
   708  		"node/sc/config.go":                                  "eth/config.go",
   709  		"node/sc/mainbridge.go":                              "eth/backend.go",
   710  		"node/sc/metrics.go":                                 "eth/metrics.go",
   711  		"node/sc/protocol.go":                                "eth/protocol.go",
   712  		"node/sc/subbridge.go":                               "eth/backend.go",
   713  		"node/service_test.go":                               "node/service_test.go",
   714  		"node/defaults.go":                                   "node/defaults.go",
   715  		"node/api.go":                                        "node/api.go",
   716  		"node/node_test.go":                                  "node/node_test.go",
   717  		"node/config_test.go":                                "node/config_test.go",
   718  		"node/node.go":                                       "node/node.go",
   719  		"node/errors.go":                                     "node/errors.go",
   720  		"event/subscription.go":                              "event/subscription.go",
   721  		"event/example_test.go":                              "event/example_test.go",
   722  		"event/event.go":                                     "event/event.go",
   723  		"event/feed.go":                                      "event/feed.go",
   724  		"event/event_test.go":                                "event/event_test.go",
   725  		"event/example_feed_test.go":                         "event/example_feed_test.go",
   726  		"event/subscription_test.go":                         "event/subscription_test.go",
   727  		"event/example_scope_test.go":                        "event/example_scope_test.go",
   728  		"event/feed_test.go":                                 "event/feed_test.go",
   729  		"event/example_subscription_test.go":                 "event/example_subscription_test.go",
   730  		"event/filter/generic_filter.go":                     "event/filter/generic_filter.go",
   731  		"event/filter/filter.go":                             "event/filter/filter.go",
   732  		"client/klay_client.go":                              "ethclient/ethclient.go",
   733  		"client/klay_client_test.go":                         "ethclient/ethclient_test.go",
   734  		"client/signer.go":                                   "ethclient/signer.go",
   735  		"client/bridge_client.go":                            "ethclient/ethclient.go",
   736  		"console/prompter.go":                                "console/prompter.go",
   737  		"console/console.go":                                 "console/console.go",
   738  		"console/bridge.go":                                  "console/bridge.go",
   739  		"console/console_test.go":                            "console/console_test.go",
   740  		"console/web3ext/web3ext.go":                         "internal/web3ext/web3ext.go",
   741  		"console/jsre/completion.go":                         "internal/jsre/completion.go",
   742  		"console/jsre/completion_test.go":                    "internal/jsre/completion_test.go",
   743  		"console/jsre/jsre.go":                               "internal/jsre/jsre.go",
   744  		"console/jsre/jsre_test.go":                          "internal/jsre/jsre_test.go",
   745  		"console/jsre/pretty.go":                             "internal/jsre/pretty.go",
   746  		"console/jsre/deps/deps.go":                          "internal/jsre/deps/deps.go",
   747  		"console/jsre/deps/bindata.go":                       "internal/jsre/deps/bindata.go",
   748  	}
   749  )
   750  
   751  // this template generates the license comment.
   752  // its input is an info structure.
   753  var klaytnLicenseT = template.Must(template.New("").Parse(`
   754  // Copyright {{.Year}} The klaytn Authors
   755  // This file is part of the klaytn library.
   756  //
   757  // The klaytn library is free software: you can redistribute it and/or modify
   758  // it under the terms of the GNU Lesser General Public License as published by
   759  // the Free Software Foundation, either version 3 of the License, or
   760  // (at your option) any later version.
   761  //
   762  // The klaytn library is distributed in the hope that it will be useful,
   763  // but WITHOUT ANY WARRANTY; without even the implied warranty of
   764  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   765  // GNU Lesser General Public License for more details.
   766  //
   767  // You should have received a copy of the GNU Lesser General Public License
   768  // along with the klaytn library. If not, see <http://www.gnu.org/licenses/>.`[1:]))
   769  
   770  // this template generates the license comment.
   771  // its input is an info structure.
   772  var mixedLicenseT = template.Must(template.New("").Parse(`
   773  // Modifications Copyright {{.Year}} The klaytn Authors
   774  {{.OtherLicence}}
   775  //
   776  // This file is derived from {{.File}} (2018/06/04).
   777  // Modified and improved for the klaytn development.`[1:]))
   778  
   779  // this template generates the license comment.
   780  // its input is an info structure.
   781  var externalLicenseT = template.Must(template.New("").Parse(`
   782  // Copyright {{.Year}} The klaytn Authors
   783  //
   784  // This file is derived from {{.File}} (2018/06/04).
   785  // See LICENSE in the top directory for the original copyright and license.`[1:]))
   786  
   787  type info struct {
   788  	file         string
   789  	Year         int64
   790  	LastCommit   int64 // unit: YYYY
   791  	otherLicence string
   792  }
   793  
   794  // File get derived ethereum path
   795  func (i info) File() string {
   796  	etherdir, exists := ethereumDir[i.file]
   797  	if !exists {
   798  		fmt.Printf("Check ethereum dir : %s \n", i.file)
   799  	}
   800  	return etherdir
   801  }
   802  
   803  // get original ethereum licence
   804  func (i info) OtherLicence() string {
   805  	return i.otherLicence
   806  }
   807  
   808  func main() {
   809  	var (
   810  		files = getFiles()
   811  		filec = make(chan string)
   812  		infoc = make(chan *info, 20)
   813  		wg    sync.WaitGroup
   814  	)
   815  
   816  	// writeAuthors(files)
   817  
   818  	go func() {
   819  		for _, f := range files {
   820  			filec <- f
   821  		}
   822  		close(filec)
   823  	}()
   824  	for i := runtime.NumCPU(); i >= 0; i-- {
   825  		// getting file info is slow and needs to be parallel.
   826  		// it traverses git history for each file.
   827  		wg.Add(1)
   828  		go getInfo(filec, infoc, &wg)
   829  	}
   830  	go func() {
   831  		wg.Wait()
   832  		close(infoc)
   833  	}()
   834  	writeLicenses(infoc)
   835  }
   836  
   837  // skipFile returns whether the path updates the license
   838  func skipFile(path string) bool {
   839  	if strings.Contains(path, "/testdata/") {
   840  		return true
   841  	}
   842  	for _, p := range skipPrefixes {
   843  		if strings.HasPrefix(path, p) {
   844  			return true
   845  		}
   846  	}
   847  
   848  	for _, p := range skipSuffixes {
   849  		if strings.HasSuffix(path, p) {
   850  			return true
   851  		}
   852  	}
   853  
   854  	return false
   855  }
   856  
   857  // externalLiceceFile returns whether the path has external license
   858  func externalLicenceFile(path string) bool {
   859  	for _, p := range externalLicencePrefixes {
   860  		if strings.HasPrefix(path, p) {
   861  			return true
   862  		}
   863  	}
   864  	return false
   865  }
   866  
   867  // getFiles returns all klaytn files
   868  func getFiles() []string {
   869  	cmd := exec.Command("git", "ls-tree", "-r", "--name-only", "HEAD")
   870  	var files []string
   871  	err := doLines(cmd, func(line string) {
   872  		if skipFile(line) {
   873  			return
   874  		}
   875  		ext := filepath.Ext(line)
   876  		for _, wantExt := range extensions {
   877  			if ext == wantExt {
   878  				goto keep
   879  			}
   880  		}
   881  		return
   882  	keep:
   883  		files = append(files, line)
   884  	})
   885  	if err != nil {
   886  		log.Fatal("error getting files:", err)
   887  	}
   888  	return files
   889  }
   890  
   891  var authorRegexp = regexp.MustCompile(`\s*[0-9]+\s*(.*)`)
   892  
   893  // gitAuthors returns git authors from files
   894  func gitAuthors(files []string) []string {
   895  	cmds := []string{"shortlog", "-s", "-n", "-e", "HEAD", "--"}
   896  	cmds = append(cmds, files...)
   897  	cmd := exec.Command("git", cmds...)
   898  	var authors []string
   899  	err := doLines(cmd, func(line string) {
   900  		m := authorRegexp.FindStringSubmatch(line)
   901  		if len(m) > 1 {
   902  			authors = append(authors, m[1])
   903  		}
   904  	})
   905  	if err != nil {
   906  		log.Fatalln("error getting authors:", err)
   907  	}
   908  	return authors
   909  }
   910  
   911  // gitAuthors returns git authors from AUTHORS file
   912  func readAuthors() []string {
   913  	content, err := ioutil.ReadFile("AUTHORS")
   914  	if err != nil && !os.IsNotExist(err) {
   915  		log.Fatalln("error reading AUTHORS:", err)
   916  	}
   917  	var authors []string
   918  	for _, a := range bytes.Split(content, []byte("\n")) {
   919  		if len(a) > 0 && a[0] != '#' {
   920  			authors = append(authors, string(a))
   921  		}
   922  	}
   923  	// Retranslate existing authors through .mailmap.
   924  	// This should catch email address changes.
   925  	authors = mailmapLookup(authors)
   926  	return authors
   927  }
   928  
   929  func mailmapLookup(authors []string) []string {
   930  	if len(authors) == 0 {
   931  		return nil
   932  	}
   933  	cmds := []string{"check-mailmap", "--"}
   934  	cmds = append(cmds, authors...)
   935  	cmd := exec.Command("git", cmds...)
   936  	var translated []string
   937  	err := doLines(cmd, func(line string) {
   938  		translated = append(translated, line)
   939  	})
   940  	if err != nil {
   941  		log.Fatalln("error translating authors:", err)
   942  	}
   943  	return translated
   944  }
   945  
   946  func writeAuthors(files []string) {
   947  	merge := make(map[string]bool)
   948  	// Add authors that Git reports as contributorxs.
   949  	// This is the primary source of author information.
   950  	for _, a := range gitAuthors(files) {
   951  		merge[a] = true
   952  	}
   953  	// Add existing authors from the file. This should ensure that we
   954  	// never lose authors, even if Git stops listing them. We can also
   955  	// add authors manually this way.
   956  	for _, a := range readAuthors() {
   957  		merge[a] = true
   958  	}
   959  	// Write sorted list of authors back to the file.
   960  	var result []string
   961  	for a := range merge {
   962  		result = append(result, a)
   963  	}
   964  	sort.Strings(result)
   965  	content := new(bytes.Buffer)
   966  	content.WriteString(authorsFileHeader)
   967  	for _, a := range result {
   968  		content.WriteString(a)
   969  		content.WriteString("\n")
   970  	}
   971  	fmt.Println("writing AUTHORS")
   972  	if err := ioutil.WriteFile("AUTHORS", content.Bytes(), 0o644); err != nil {
   973  		log.Fatalln(err)
   974  	}
   975  }
   976  
   977  func getInfo(files <-chan string, out chan<- *info, wg *sync.WaitGroup) {
   978  	for file := range files {
   979  		fmt.Println(file)
   980  		stat, err := os.Lstat(file)
   981  		if err != nil {
   982  			fmt.Printf("ERROR %s: %v\n", file, err)
   983  			continue
   984  		}
   985  		if !stat.Mode().IsRegular() {
   986  			continue
   987  		}
   988  		if isGenerated(file) {
   989  			continue
   990  		}
   991  		info, err := fileInfo(file)
   992  		if err != nil {
   993  			fmt.Printf("ERROR %s: %v\n", file, err)
   994  			continue
   995  		}
   996  		if info.LastCommit <= 2018 {
   997  			continue
   998  		}
   999  		out <- info
  1000  	}
  1001  	wg.Done()
  1002  }
  1003  
  1004  // isGenerated returns whether the input file is an automatically generated file.
  1005  func isGenerated(file string) bool {
  1006  	fd, err := os.Open(file)
  1007  	if err != nil {
  1008  		return false
  1009  	}
  1010  	defer fd.Close()
  1011  	buf := make([]byte, 2048)
  1012  	n, _ := fd.Read(buf)
  1013  	buf = buf[:n]
  1014  	for _, l := range bytes.Split(buf, []byte("\n")) {
  1015  		if bytes.HasPrefix(l, []byte("// Code generated")) {
  1016  			return true
  1017  		}
  1018  	}
  1019  	return false
  1020  }
  1021  
  1022  // fileInfo finds the lowest year in which the given file was committed.
  1023  func fileInfo(file string) (*info, error) {
  1024  	info := &info{file: file, Year: int64(time.Now().Year()), LastCommit: 0}
  1025  	cmd := exec.Command("git", "log", "--follow", "--find-renames=80", "--find-copies=80", "--pretty=format:%ai", "--", file)
  1026  	err := doLines(cmd, func(line string) {
  1027  		y, err := strconv.ParseInt(line[:4], 10, 64)
  1028  		if err != nil {
  1029  			fmt.Printf("cannot parse year: %q", line[:4])
  1030  		}
  1031  		if y < info.Year {
  1032  			info.Year = y
  1033  		}
  1034  		if y > info.LastCommit {
  1035  			info.LastCommit = y
  1036  		}
  1037  	})
  1038  	return info, err
  1039  }
  1040  
  1041  // writeLicenses write the licenses in the files path in infos.
  1042  func writeLicenses(infos <-chan *info) {
  1043  	for i := range infos {
  1044  		writeLicense(i)
  1045  	}
  1046  }
  1047  
  1048  // writeLicense write the license in the file path in info.
  1049  func writeLicense(info *info) {
  1050  	fi, err := os.Stat(info.file)
  1051  	if os.IsNotExist(err) {
  1052  		fmt.Println("skipping (does not exist)", info.file)
  1053  		return
  1054  	}
  1055  	if err != nil {
  1056  		log.Fatalf("error stat'ing %s: %v\n", info.file, err)
  1057  	}
  1058  	content, err := ioutil.ReadFile(info.file)
  1059  	if err != nil {
  1060  		log.Fatalf("error reading %s: %v\n", info.file, err)
  1061  	}
  1062  	// Construct new file content.
  1063  	buf := new(bytes.Buffer)
  1064  
  1065  	if m := mixedLicenseCommentRE.FindIndex(content); m != nil {
  1066  		if e := ethereumLicenseCommentRE.FindIndex(content); e != nil {
  1067  			info.otherLicence = string(content[e[0]:e[1]])
  1068  			mixedLicenseT.Execute(buf, info)
  1069  			buf.Write(content[m[1]:])
  1070  		} else {
  1071  			return
  1072  		}
  1073  	} else if m := ethereumLicenseCommentRE.FindIndex(content); m != nil {
  1074  		info.otherLicence = string(content[m[0]:m[1]])
  1075  		mixedLicenseT.Execute(buf, info)
  1076  		buf.Write(content[m[1]:])
  1077  	} else if m := klaytnLicenseCommentRE.FindIndex(content); m != nil {
  1078  		klaytnLicenseT.Execute(buf, info)
  1079  		buf.Write(content[m[1]:])
  1080  	} else if m := externalLicenceCommentRE.FindIndex(content); m != nil {
  1081  		externalLicenseT.Execute(buf, info)
  1082  		buf.Write(content[m[1]:])
  1083  	} else {
  1084  		if externalLicenceFile(info.file) {
  1085  			externalLicenseT.Execute(buf, info)
  1086  		} else {
  1087  			klaytnLicenseT.Execute(buf, info)
  1088  		}
  1089  		buf.Write([]byte("\n\n"))
  1090  		buf.Write(content)
  1091  	}
  1092  
  1093  	// Write it to the file.
  1094  	if bytes.Equal(content, buf.Bytes()) {
  1095  		fmt.Println("skipping (no changes)", info.file)
  1096  		return
  1097  	}
  1098  	if err := ioutil.WriteFile(info.file, buf.Bytes(), fi.Mode()); err != nil {
  1099  		log.Fatalf("error writing %s: %v", info.file, err)
  1100  	}
  1101  }
  1102  
  1103  // dolines executes cmd
  1104  func doLines(cmd *exec.Cmd, f func(string)) error {
  1105  	stdout, err := cmd.StdoutPipe()
  1106  	if err != nil {
  1107  		return err
  1108  	}
  1109  	if err := cmd.Start(); err != nil {
  1110  		return err
  1111  	}
  1112  	s := bufio.NewScanner(stdout)
  1113  	for s.Scan() {
  1114  		f(s.Text())
  1115  	}
  1116  	if s.Err() != nil {
  1117  		return s.Err()
  1118  	}
  1119  	if err := cmd.Wait(); err != nil {
  1120  		return fmt.Errorf("%v (for %s)", err, strings.Join(cmd.Args, " "))
  1121  	}
  1122  	return nil
  1123  }