github.com/hasnat/dolt/go@v0.0.0-20210628190320-9eb5d843fbb7/utils/copyrightshdrs/main.go (about) 1 // Copyright 2019 Dolthub, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package main 16 17 import ( 18 "fmt" 19 "io/ioutil" 20 "os" 21 "path/filepath" 22 "regexp" 23 "strings" 24 ) 25 26 var ExpectedHeader = regexp.MustCompile(`// Copyright (2019|2020|2021|2019-2020|2019-2021|2020-2021) Dolthub, Inc. 27 // 28 // Licensed under the Apache License, Version 2.0 \(the "License"\); 29 // you may not use this file except in compliance with the License. 30 // You may obtain a copy of the License at 31 // 32 // http://www.apache.org/licenses/LICENSE-2.0 33 // 34 // Unless required by applicable law or agreed to in writing, software 35 // distributed under the License is distributed on an "AS IS" BASIS, 36 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 // See the License for the specific language governing permissions and 38 // limitations under the License. 39 40 `) 41 42 var ExpectedHeaderForFileFromNoms = regexp.MustCompile(`// Copyright (2019|2020|2021|2019-2020|2019-2021|2020-2021) Dolthub, Inc. 43 // 44 // Licensed under the Apache License, Version 2.0 \(the "License"\); 45 // you may not use this file except in compliance with the License. 46 // You may obtain a copy of the License at 47 // 48 // http://www.apache.org/licenses/LICENSE-2.0 49 // 50 // Unless required by applicable law or agreed to in writing, software 51 // distributed under the License is distributed on an "AS IS" BASIS, 52 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 53 // See the License for the specific language governing permissions and 54 // limitations under the License. 55 // 56 // This file incorporates work covered by the following copyright and 57 // permission notice: 58 // 59 // Copyright`) 60 61 type CopiedNomsFile struct { 62 Path string 63 NomsPath string 64 HadCopyrightNotice bool 65 } 66 67 // Noms file paths referenced from a1f990c94dcc03f9f1845d25a55e84108f1be673 in github.com/attic-labs/noms. 68 var CopiedNomsFiles []CopiedNomsFile = []CopiedNomsFile{ 69 // These started as slightly modified copies of existing noms value implementations. 70 {Path: "store/types/float.go", NomsPath: "go/types/number.go", HadCopyrightNotice: true}, 71 {Path: "store/types/float_util.go", NomsPath: "go/types/number_util.go", HadCopyrightNotice: true}, 72 {Path: "store/types/int.go", NomsPath: "go/types/number.go", HadCopyrightNotice: true}, 73 {Path: "store/types/null_value.go", NomsPath: "go/types/number.go", HadCopyrightNotice: true}, 74 {Path: "store/types/tuple.go", NomsPath: "go/types/struct.go", HadCopyrightNotice: true}, 75 {Path: "store/types/uint.go", NomsPath: "go/types/number.go", HadCopyrightNotice: true}, 76 77 // These included source files from noms did not have copyright notices. 78 {Path: "store/types/common_supertype.go", NomsPath: "go/types/common_supertype.go", HadCopyrightNotice: false}, 79 {Path: "store/types/common_supertype_test.go", NomsPath: "go/types/common_supertype_test.go", HadCopyrightNotice: false}, 80 {Path: "store/types/simplify.go", NomsPath: "go/types/simplify.go", HadCopyrightNotice: false}, 81 {Path: "store/types/simplify_test.go", NomsPath: "go/types/simplify_test.go", HadCopyrightNotice: false}, 82 {Path: "store/util/random/id.go", NomsPath: "go/util/random/id.go", HadCopyrightNotice: false}, 83 {Path: "store/util/random/id_test.go", NomsPath: "go/util/random/id_test.go", HadCopyrightNotice: false}, 84 85 // These files started as almost direct copies, potentially with some moving. 86 {Path: "store/cmd/noms/util/check_error.go", NomsPath: "go/d/check_error.go", HadCopyrightNotice: true}, 87 {Path: "store/cmd/noms/util/command.go", NomsPath: "cmd/util/command.go", HadCopyrightNotice: true}, 88 {Path: "store/cmd/noms/util/help.go", NomsPath: "cmd/util/help.go", HadCopyrightNotice: true}, 89 {Path: "store/cmd/noms/util/kingpin_command.go", NomsPath: "cmd/util/kingpin_command.go", HadCopyrightNotice: true}, 90 {Path: "store/chunks/chunk.go", NomsPath: "go/chunks/chunk.go", HadCopyrightNotice: true}, 91 {Path: "store/chunks/chunk_serializer.go", NomsPath: "go/chunks/chunk_serializer.go", HadCopyrightNotice: true}, 92 {Path: "store/chunks/chunk_serializer_test.go", NomsPath: "go/chunks/chunk_serializer_test.go", HadCopyrightNotice: true}, 93 {Path: "store/chunks/chunk_store.go", NomsPath: "go/chunks/chunk_store.go", HadCopyrightNotice: true}, 94 {Path: "store/chunks/chunk_store_common_test.go", NomsPath: "go/chunks/chunk_store_common_test.go", HadCopyrightNotice: true}, 95 {Path: "store/chunks/chunk_test.go", NomsPath: "go/chunks/chunk_test.go", HadCopyrightNotice: true}, 96 {Path: "store/chunks/memory_store.go", NomsPath: "go/chunks/memory_store.go", HadCopyrightNotice: true}, 97 {Path: "store/chunks/memory_store_test.go", NomsPath: "go/chunks/memory_store_test.go", HadCopyrightNotice: true}, 98 {Path: "store/chunks/remote_requests.go", NomsPath: "go/chunks/remote_requests.go", HadCopyrightNotice: true}, 99 {Path: "store/chunks/remote_requests_test.go", NomsPath: "go/chunks/remote_requests_test.go", HadCopyrightNotice: true}, 100 {Path: "store/chunks/test_utils.go", NomsPath: "go/chunks/test_utils.go", HadCopyrightNotice: true}, 101 {Path: "store/cmd/noms/commit_iterator.go", NomsPath: "cmd/noms/commit_iterator.go", HadCopyrightNotice: true}, 102 {Path: "store/cmd/noms/noms.go", NomsPath: "cmd/noms/noms.go", HadCopyrightNotice: true}, 103 {Path: "store/cmd/noms/noms_blob.go", NomsPath: "cmd/noms/noms_blob.go", HadCopyrightNotice: true}, 104 {Path: "store/cmd/noms/noms_blob_get.go", NomsPath: "cmd/noms/noms_blob_get.go", HadCopyrightNotice: true}, 105 {Path: "store/cmd/noms/noms_blob_get_test.go", NomsPath: "cmd/noms/noms_blob_get_test.go", HadCopyrightNotice: true}, 106 {Path: "store/cmd/noms/noms_blob_put.go", NomsPath: "cmd/noms/noms_blob_put.go", HadCopyrightNotice: true}, 107 {Path: "store/cmd/noms/noms_commit.go", NomsPath: "cmd/noms/noms_commit.go", HadCopyrightNotice: true}, 108 {Path: "store/cmd/noms/noms_commit_test.go", NomsPath: "cmd/noms/noms_commit_test.go", HadCopyrightNotice: true}, 109 {Path: "store/cmd/noms/noms_config.go", NomsPath: "cmd/noms/noms_config.go", HadCopyrightNotice: true}, 110 {Path: "store/cmd/noms/noms_diff.go", NomsPath: "cmd/noms/noms_diff.go", HadCopyrightNotice: true}, 111 {Path: "store/cmd/noms/noms_diff_test.go", NomsPath: "cmd/noms/noms_diff_test.go", HadCopyrightNotice: true}, 112 {Path: "store/cmd/noms/noms_ds.go", NomsPath: "cmd/noms/noms_ds.go", HadCopyrightNotice: true}, 113 {Path: "store/cmd/noms/noms_ds_test.go", NomsPath: "cmd/noms/noms_ds_test.go", HadCopyrightNotice: true}, 114 {Path: "store/cmd/noms/noms_list.go", NomsPath: "cmd/noms/noms_list.go", HadCopyrightNotice: true}, 115 {Path: "store/cmd/noms/noms_log.go", NomsPath: "cmd/noms/noms_log.go", HadCopyrightNotice: true}, 116 {Path: "store/cmd/noms/noms_log_test.go", NomsPath: "cmd/noms/noms_log_test.go", HadCopyrightNotice: true}, 117 {Path: "store/cmd/noms/noms_map.go", NomsPath: "cmd/noms/noms_map.go", HadCopyrightNotice: true}, 118 {Path: "store/cmd/noms/noms_merge.go", NomsPath: "cmd/noms/noms_merge.go", HadCopyrightNotice: true}, 119 {Path: "store/cmd/noms/noms_merge_test.go", NomsPath: "cmd/noms/noms_merge_test.go", HadCopyrightNotice: true}, 120 {Path: "store/cmd/noms/noms_root.go", NomsPath: "cmd/noms/noms_root.go", HadCopyrightNotice: true}, 121 {Path: "store/cmd/noms/noms_root_test.go", NomsPath: "cmd/noms/noms_root_test.go", HadCopyrightNotice: true}, 122 {Path: "store/cmd/noms/noms_set.go", NomsPath: "cmd/noms/noms_set.go", HadCopyrightNotice: true}, 123 {Path: "store/cmd/noms/noms_show.go", NomsPath: "cmd/noms/noms_show.go", HadCopyrightNotice: true}, 124 {Path: "store/cmd/noms/noms_show_test.go", NomsPath: "cmd/noms/noms_show_test.go", HadCopyrightNotice: true}, 125 {Path: "store/cmd/noms/noms_stats.go", NomsPath: "cmd/noms/noms_stats.go", HadCopyrightNotice: true}, 126 {Path: "store/cmd/noms/noms_struct.go", NomsPath: "cmd/noms/noms_struct.go", HadCopyrightNotice: true}, 127 {Path: "store/cmd/noms/noms_sync.go", NomsPath: "cmd/noms/noms_sync.go", HadCopyrightNotice: true}, 128 {Path: "store/cmd/noms/noms_sync_test.go", NomsPath: "cmd/noms/noms_sync_test.go", HadCopyrightNotice: true}, 129 {Path: "store/cmd/noms/noms_version.go", NomsPath: "cmd/noms/noms_version.go", HadCopyrightNotice: true}, 130 {Path: "store/cmd/noms/noms_version_test.go", NomsPath: "cmd/noms/noms_version_test.go", HadCopyrightNotice: true}, 131 {Path: "store/config/config.go", NomsPath: "go/config/config.go", HadCopyrightNotice: true}, 132 {Path: "store/config/config_test.go", NomsPath: "go/config/config_test.go", HadCopyrightNotice: true}, 133 {Path: "store/config/resolver.go", NomsPath: "go/config/resolver.go", HadCopyrightNotice: true}, 134 {Path: "store/config/resolver_test.go", NomsPath: "go/config/resolver_test.go", HadCopyrightNotice: true}, 135 {Path: "store/constants/version.go", NomsPath: "go/constants/version.go", HadCopyrightNotice: true}, 136 {Path: "store/d/try.go", NomsPath: "go/d/try.go", HadCopyrightNotice: true}, 137 {Path: "store/d/try_test.go", NomsPath: "go/d/try_test.go", HadCopyrightNotice: true}, 138 {Path: "store/datas/commit.go", NomsPath: "go/datas/commit.go", HadCopyrightNotice: true}, 139 {Path: "store/datas/commit_options.go", NomsPath: "go/datas/commit_options.go", HadCopyrightNotice: true}, 140 {Path: "store/datas/commit_test.go", NomsPath: "go/datas/commit_test.go", HadCopyrightNotice: true}, 141 {Path: "store/datas/database.go", NomsPath: "go/datas/database.go", HadCopyrightNotice: true}, 142 {Path: "store/datas/database_common.go", NomsPath: "go/datas/database_common.go", HadCopyrightNotice: true}, 143 {Path: "store/datas/database_test.go", NomsPath: "go/datas/database_test.go", HadCopyrightNotice: true}, 144 {Path: "store/datas/dataset.go", NomsPath: "go/datas/dataset.go", HadCopyrightNotice: true}, 145 {Path: "store/datas/dataset_test.go", NomsPath: "go/datas/dataset_test.go", HadCopyrightNotice: true}, 146 {Path: "store/datas/pull.go", NomsPath: "go/datas/pull.go", HadCopyrightNotice: true}, 147 {Path: "store/datas/pull_test.go", NomsPath: "go/datas/pull_test.go", HadCopyrightNotice: true}, 148 {Path: "store/datas/serialize_hashes.go", NomsPath: "go/datas/serialize_hashes.go", HadCopyrightNotice: true}, 149 {Path: "store/datas/serialize_hashes_test.go", NomsPath: "go/datas/serialize_hashes_test.go", HadCopyrightNotice: true}, 150 {Path: "store/diff/apply_patch.go", NomsPath: "go/diff/apply_patch.go", HadCopyrightNotice: true}, 151 {Path: "store/diff/apply_patch_test.go", NomsPath: "go/diff/apply_patch_test.go", HadCopyrightNotice: true}, 152 {Path: "store/diff/diff.go", NomsPath: "go/diff/diff.go", HadCopyrightNotice: true}, 153 {Path: "store/diff/diff_test.go", NomsPath: "go/diff/diff_test.go", HadCopyrightNotice: true}, 154 {Path: "store/diff/patch.go", NomsPath: "go/diff/patch.go", HadCopyrightNotice: true}, 155 {Path: "store/diff/patch_test.go", NomsPath: "go/diff/patch_test.go", HadCopyrightNotice: true}, 156 {Path: "store/diff/print_diff.go", NomsPath: "go/diff/print_diff.go", HadCopyrightNotice: true}, 157 {Path: "store/diff/summary.go", NomsPath: "go/diff/summary.go", HadCopyrightNotice: true}, 158 {Path: "store/hash/base32.go", NomsPath: "go/hash/base32.go", HadCopyrightNotice: true}, 159 {Path: "store/hash/base32_test.go", NomsPath: "go/hash/base32_test.go", HadCopyrightNotice: true}, 160 {Path: "store/hash/hash.go", NomsPath: "go/hash/hash.go", HadCopyrightNotice: true}, 161 {Path: "store/hash/hash_slice.go", NomsPath: "go/hash/hash_slice.go", HadCopyrightNotice: true}, 162 {Path: "store/hash/hash_slice_test.go", NomsPath: "go/hash/hash_slice_test.go", HadCopyrightNotice: true}, 163 {Path: "store/hash/hash_test.go", NomsPath: "go/hash/hash_test.go", HadCopyrightNotice: true}, 164 {Path: "store/marshal/decode.go", NomsPath: "go/marshal/decode.go", HadCopyrightNotice: true}, 165 {Path: "store/marshal/decode_test.go", NomsPath: "go/marshal/decode_test.go", HadCopyrightNotice: true}, 166 {Path: "store/marshal/encode.go", NomsPath: "go/marshal/encode.go", HadCopyrightNotice: true}, 167 {Path: "store/marshal/encode_test.go", NomsPath: "go/marshal/encode_test.go", HadCopyrightNotice: true}, 168 {Path: "store/marshal/encode_type.go", NomsPath: "go/marshal/encode_type.go", HadCopyrightNotice: true}, 169 {Path: "store/marshal/encode_type_test.go", NomsPath: "go/marshal/encode_type_test.go", HadCopyrightNotice: true}, 170 {Path: "store/merge/candidate.go", NomsPath: "go/merge/candidate.go", HadCopyrightNotice: true}, 171 {Path: "store/merge/three_way.go", NomsPath: "go/merge/three_way.go", HadCopyrightNotice: true}, 172 {Path: "store/merge/three_way_keyval_test.go", NomsPath: "go/merge/three_way_keyval_test.go", HadCopyrightNotice: true}, 173 {Path: "store/merge/three_way_list.go", NomsPath: "go/merge/three_way_list.go", HadCopyrightNotice: true}, 174 {Path: "store/merge/three_way_list_test.go", NomsPath: "go/merge/three_way_list_test.go", HadCopyrightNotice: true}, 175 {Path: "store/merge/three_way_ordered_sequence.go", NomsPath: "go/merge/three_way_ordered_sequence.go", HadCopyrightNotice: true}, 176 {Path: "store/merge/three_way_set_test.go", NomsPath: "go/merge/three_way_set_test.go", HadCopyrightNotice: true}, 177 {Path: "store/merge/three_way_test.go", NomsPath: "go/merge/three_way_test.go", HadCopyrightNotice: true}, 178 {Path: "store/metrics/histogram.go", NomsPath: "go/metrics/histogram.go", HadCopyrightNotice: true}, 179 {Path: "store/metrics/histogram_test.go", NomsPath: "go/metrics/histogram_test.go", HadCopyrightNotice: true}, 180 {Path: "store/nbs/aws_chunk_source.go", NomsPath: "go/nbs/aws_chunk_source.go", HadCopyrightNotice: true}, 181 {Path: "store/nbs/aws_chunk_source_test.go", NomsPath: "go/nbs/aws_chunk_source_test.go", HadCopyrightNotice: true}, 182 {Path: "store/nbs/aws_table_persister.go", NomsPath: "go/nbs/aws_table_persister.go", HadCopyrightNotice: true}, 183 {Path: "store/nbs/aws_table_persister_test.go", NomsPath: "go/nbs/aws_table_persister_test.go", HadCopyrightNotice: true}, 184 {Path: "store/nbs/benchmarks/block_store_benchmarks.go", NomsPath: "go/nbs/benchmarks/block_store_benchmarks.go", HadCopyrightNotice: true}, 185 {Path: "store/nbs/benchmarks/cachedrop/drop_cache.go", NomsPath: "go/nbs/benchmarks/cachedrop/drop_cache.go", HadCopyrightNotice: true}, 186 {Path: "store/nbs/benchmarks/chunker/main.go", NomsPath: "go/nbs/benchmarks/chunker/main.go", HadCopyrightNotice: true}, 187 {Path: "store/nbs/benchmarks/data_source.go", NomsPath: "go/nbs/benchmarks/data_source.go", HadCopyrightNotice: true}, 188 {Path: "store/nbs/benchmarks/drop_cache_linux.go", NomsPath: "go/nbs/benchmarks/drop_cache_linux.go", HadCopyrightNotice: true}, 189 {Path: "store/nbs/benchmarks/drop_cache_other.go", NomsPath: "go/nbs/benchmarks/drop_cache_other.go", HadCopyrightNotice: true}, 190 {Path: "store/nbs/benchmarks/file_block_store.go", NomsPath: "go/nbs/benchmarks/file_block_store.go", HadCopyrightNotice: true}, 191 {Path: "store/nbs/benchmarks/gen/gen.go", NomsPath: "go/nbs/benchmarks/gen/gen.go", HadCopyrightNotice: true}, 192 {Path: "store/nbs/benchmarks/gen/rolling_value_hasher.go", NomsPath: "go/nbs/benchmarks/gen/rolling_value_hasher.go", HadCopyrightNotice: true}, 193 {Path: "store/nbs/benchmarks/main.go", NomsPath: "go/nbs/benchmarks/main.go", HadCopyrightNotice: true}, 194 {Path: "store/nbs/benchmarks/null_block_store.go", NomsPath: "go/nbs/benchmarks/null_block_store.go", HadCopyrightNotice: true}, 195 {Path: "store/nbs/block_store_test.go", NomsPath: "go/nbs/block_store_test.go", HadCopyrightNotice: true}, 196 {Path: "store/nbs/cache.go", NomsPath: "go/nbs/cache.go", HadCopyrightNotice: true}, 197 {Path: "store/nbs/conjoiner.go", NomsPath: "go/nbs/conjoiner.go", HadCopyrightNotice: true}, 198 {Path: "store/nbs/conjoiner_test.go", NomsPath: "go/nbs/conjoiner_test.go", HadCopyrightNotice: true}, 199 {Path: "store/nbs/dynamo_fake_test.go", NomsPath: "go/nbs/dynamo_fake_test.go", HadCopyrightNotice: true}, 200 {Path: "store/nbs/dynamo_manifest.go", NomsPath: "go/nbs/dynamo_manifest.go", HadCopyrightNotice: true}, 201 {Path: "store/nbs/dynamo_manifest_test.go", NomsPath: "go/nbs/dynamo_manifest_test.go", HadCopyrightNotice: true}, 202 {Path: "store/nbs/dynamo_table_reader.go", NomsPath: "go/nbs/dynamo_table_reader.go", HadCopyrightNotice: true}, 203 {Path: "store/nbs/dynamo_table_reader_test.go", NomsPath: "go/nbs/dynamo_table_reader_test.go", HadCopyrightNotice: true}, 204 {Path: "store/nbs/fd_cache.go", NomsPath: "go/nbs/fd_cache.go", HadCopyrightNotice: true}, 205 {Path: "store/nbs/fd_cache_test.go", NomsPath: "go/nbs/fd_cache_test.go", HadCopyrightNotice: true}, 206 {Path: "store/nbs/file_manifest.go", NomsPath: "go/nbs/file_manifest.go", HadCopyrightNotice: true}, 207 {Path: "store/nbs/file_manifest_test.go", NomsPath: "go/nbs/file_manifest_test.go", HadCopyrightNotice: true}, 208 {Path: "store/nbs/file_table_persister.go", NomsPath: "go/nbs/file_table_persister.go", HadCopyrightNotice: true}, 209 {Path: "store/nbs/file_table_persister_test.go", NomsPath: "go/nbs/file_table_persister_test.go", HadCopyrightNotice: true}, 210 {Path: "store/nbs/frag/main.go", NomsPath: "go/nbs/frag/main.go", HadCopyrightNotice: true}, 211 {Path: "store/nbs/fs_table_cache.go", NomsPath: "go/nbs/fs_table_cache.go", HadCopyrightNotice: true}, 212 {Path: "store/nbs/fs_table_cache_test.go", NomsPath: "go/nbs/fs_table_cache_test.go", HadCopyrightNotice: true}, 213 {Path: "store/nbs/manifest.go", NomsPath: "go/nbs/manifest.go", HadCopyrightNotice: true}, 214 {Path: "store/nbs/manifest_cache.go", NomsPath: "go/nbs/manifest_cache.go", HadCopyrightNotice: true}, 215 {Path: "store/nbs/manifest_cache_test.go", NomsPath: "go/nbs/manifest_cache_test.go", HadCopyrightNotice: true}, 216 {Path: "store/nbs/mem_table.go", NomsPath: "go/nbs/mem_table.go", HadCopyrightNotice: true}, 217 {Path: "store/nbs/mem_table_test.go", NomsPath: "go/nbs/mem_table_test.go", HadCopyrightNotice: true}, 218 {Path: "store/nbs/mmap_table_reader.go", NomsPath: "go/nbs/mmap_table_reader.go", HadCopyrightNotice: true}, 219 {Path: "store/nbs/mmap_table_reader_test.go", NomsPath: "go/nbs/mmap_table_reader_test.go", HadCopyrightNotice: true}, 220 {Path: "store/nbs/persisting_chunk_source.go", NomsPath: "go/nbs/persisting_chunk_source.go", HadCopyrightNotice: true}, 221 {Path: "store/nbs/persisting_chunk_source_test.go", NomsPath: "go/nbs/persisting_chunk_source_test.go", HadCopyrightNotice: true}, 222 {Path: "store/nbs/root_tracker_test.go", NomsPath: "go/nbs/root_tracker_test.go", HadCopyrightNotice: true}, 223 {Path: "store/nbs/s3_fake_test.go", NomsPath: "go/nbs/s3_fake_test.go", HadCopyrightNotice: true}, 224 {Path: "store/nbs/s3_table_reader.go", NomsPath: "go/nbs/s3_table_reader.go", HadCopyrightNotice: true}, 225 {Path: "store/nbs/s3_table_reader_test.go", NomsPath: "go/nbs/s3_table_reader_test.go", HadCopyrightNotice: true}, 226 {Path: "store/nbs/stats.go", NomsPath: "go/nbs/stats.go", HadCopyrightNotice: true}, 227 {Path: "store/nbs/stats_test.go", NomsPath: "go/nbs/stats_test.go", HadCopyrightNotice: true}, 228 {Path: "store/nbs/store.go", NomsPath: "go/nbs/store.go", HadCopyrightNotice: true}, 229 {Path: "store/nbs/table.go", NomsPath: "go/nbs/table.go", HadCopyrightNotice: true}, 230 {Path: "store/nbs/table_persister.go", NomsPath: "go/nbs/table_persister.go", HadCopyrightNotice: true}, 231 {Path: "store/nbs/table_persister_test.go", NomsPath: "go/nbs/table_persister_test.go", HadCopyrightNotice: true}, 232 {Path: "store/nbs/table_reader.go", NomsPath: "go/nbs/table_reader.go", HadCopyrightNotice: true}, 233 {Path: "store/nbs/table_set.go", NomsPath: "go/nbs/table_set.go", HadCopyrightNotice: true}, 234 {Path: "store/nbs/table_set_test.go", NomsPath: "go/nbs/table_set_test.go", HadCopyrightNotice: true}, 235 {Path: "store/nbs/table_test.go", NomsPath: "go/nbs/table_test.go", HadCopyrightNotice: true}, 236 {Path: "store/nbs/table_writer.go", NomsPath: "go/nbs/table_writer.go", HadCopyrightNotice: true}, 237 {Path: "store/nbs/test/manifest_clobber.go", NomsPath: "go/nbs/test/manifest_clobber.go", HadCopyrightNotice: true}, 238 {Path: "store/nomdl/lexer.go", NomsPath: "go/nomdl/lexer.go", HadCopyrightNotice: true}, 239 {Path: "store/nomdl/parser.go", NomsPath: "go/nomdl/parser.go", HadCopyrightNotice: true}, 240 {Path: "store/nomdl/parser_test.go", NomsPath: "go/nomdl/parser_test.go", HadCopyrightNotice: true}, 241 {Path: "store/perf/codec-perf-rig/main.go", NomsPath: "go/perf/codec-perf-rig/main.go", HadCopyrightNotice: true}, 242 {Path: "store/perf/hash-perf-rig/main.go", NomsPath: "go/perf/hash-perf-rig/main.go", HadCopyrightNotice: true}, 243 {Path: "store/perf/suite/suite.go", NomsPath: "go/perf/suite/suite.go", HadCopyrightNotice: true}, 244 {Path: "store/perf/suite/suite_test.go", NomsPath: "go/perf/suite/suite_test.go", HadCopyrightNotice: true}, 245 {Path: "store/sloppy/sloppy.go", NomsPath: "go/sloppy/sloppy.go", HadCopyrightNotice: true}, 246 {Path: "store/sloppy/sloppy_test.go", NomsPath: "go/sloppy/sloppy_test.go", HadCopyrightNotice: true}, 247 {Path: "store/spec/absolute_path.go", NomsPath: "go/spec/absolute_path.go", HadCopyrightNotice: true}, 248 {Path: "store/spec/absolute_path_test.go", NomsPath: "go/spec/absolute_path_test.go", HadCopyrightNotice: true}, 249 {Path: "store/spec/commit_meta.go", NomsPath: "go/spec/commit_meta.go", HadCopyrightNotice: true}, 250 {Path: "store/spec/commit_meta_test.go", NomsPath: "go/spec/commit_meta_test.go", HadCopyrightNotice: true}, 251 {Path: "store/spec/spec.go", NomsPath: "go/spec/spec.go", HadCopyrightNotice: true}, 252 {Path: "store/spec/spec_test.go", NomsPath: "go/spec/spec_test.go", HadCopyrightNotice: true}, 253 {Path: "store/spec/util.go", NomsPath: "go/spec/util.go", HadCopyrightNotice: true}, 254 {Path: "store/types/blob.go", NomsPath: "go/types/blob.go", HadCopyrightNotice: true}, 255 {Path: "store/types/blob_leaf_sequence.go", NomsPath: "go/types/blob_leaf_sequence.go", HadCopyrightNotice: true}, 256 {Path: "store/types/blob_test.go", NomsPath: "go/types/blob_test.go", HadCopyrightNotice: true}, 257 {Path: "store/types/bool.go", NomsPath: "go/types/bool.go", HadCopyrightNotice: true}, 258 {Path: "store/types/codec.go", NomsPath: "go/types/codec.go", HadCopyrightNotice: true}, 259 {Path: "store/types/codec_test.go", NomsPath: "go/types/codec_test.go", HadCopyrightNotice: true}, 260 {Path: "store/types/collection.go", NomsPath: "go/types/collection.go", HadCopyrightNotice: true}, 261 {Path: "store/types/collection_test.go", NomsPath: "go/types/collection_test.go", HadCopyrightNotice: true}, 262 {Path: "store/types/compare_test.go", NomsPath: "go/types/compare_test.go", HadCopyrightNotice: true}, 263 {Path: "store/types/edit_distance.go", NomsPath: "go/types/edit_distance.go", HadCopyrightNotice: true}, 264 {Path: "store/types/edit_distance_test.go", NomsPath: "go/types/edit_distance_test.go", HadCopyrightNotice: true}, 265 {Path: "store/types/encode_human_readable.go", NomsPath: "go/types/encode_human_readable.go", HadCopyrightNotice: true}, 266 {Path: "store/types/encode_human_readable_test.go", NomsPath: "go/types/encode_human_readable_test.go", HadCopyrightNotice: true}, 267 {Path: "store/types/encoding_test.go", NomsPath: "go/types/encoding_test.go", HadCopyrightNotice: true}, 268 {Path: "store/types/equals_test.go", NomsPath: "go/types/equals_test.go", HadCopyrightNotice: true}, 269 {Path: "store/types/get_hash.go", NomsPath: "go/types/get_hash.go", HadCopyrightNotice: true}, 270 {Path: "store/types/incremental_test.go", NomsPath: "go/types/incremental_test.go", HadCopyrightNotice: true}, 271 {Path: "store/types/indexed_sequence_diff.go", NomsPath: "go/types/indexed_sequence_diff.go", HadCopyrightNotice: true}, 272 {Path: "store/types/indexed_sequences.go", NomsPath: "go/types/indexed_sequences.go", HadCopyrightNotice: true}, 273 {Path: "store/types/leaf_sequence.go", NomsPath: "go/types/leaf_sequence.go", HadCopyrightNotice: true}, 274 {Path: "store/types/less.go", NomsPath: "go/types/less.go", HadCopyrightNotice: true}, 275 {Path: "store/types/list.go", NomsPath: "go/types/list.go", HadCopyrightNotice: true}, 276 {Path: "store/types/list_editor.go", NomsPath: "go/types/list_editor.go", HadCopyrightNotice: true}, 277 {Path: "store/types/list_editor_test.go", NomsPath: "go/types/list_editor_test.go", HadCopyrightNotice: true}, 278 {Path: "store/types/list_iterator.go", NomsPath: "go/types/list_iterator.go", HadCopyrightNotice: true}, 279 {Path: "store/types/list_iterator_test.go", NomsPath: "go/types/list_iterator_test.go", HadCopyrightNotice: true}, 280 {Path: "store/types/list_leaf_sequence.go", NomsPath: "go/types/list_leaf_sequence.go", HadCopyrightNotice: true}, 281 {Path: "store/types/list_test.go", NomsPath: "go/types/list_test.go", HadCopyrightNotice: true}, 282 {Path: "store/types/make_type.go", NomsPath: "go/types/make_type.go", HadCopyrightNotice: true}, 283 {Path: "store/types/map.go", NomsPath: "go/types/map.go", HadCopyrightNotice: true}, 284 {Path: "store/types/map_editor.go", NomsPath: "go/types/map_editor.go", HadCopyrightNotice: true}, 285 {Path: "store/types/map_iterator.go", NomsPath: "go/types/map_iterator.go", HadCopyrightNotice: true}, 286 {Path: "store/types/map_iterator_test.go", NomsPath: "go/types/map_iterator_test.go", HadCopyrightNotice: true}, 287 {Path: "store/types/map_leaf_sequence.go", NomsPath: "go/types/map_leaf_sequence.go", HadCopyrightNotice: true}, 288 {Path: "store/types/map_test.go", NomsPath: "go/types/map_test.go", HadCopyrightNotice: true}, 289 {Path: "store/types/meta_sequence.go", NomsPath: "go/types/meta_sequence.go", HadCopyrightNotice: true}, 290 {Path: "store/types/noms_kind.go", NomsPath: "go/types/noms_kind.go", HadCopyrightNotice: true}, 291 {Path: "store/types/ordered_sequences.go", NomsPath: "go/types/ordered_sequences.go", HadCopyrightNotice: true}, 292 {Path: "store/types/ordered_sequences_diff.go", NomsPath: "go/types/ordered_sequences_diff.go", HadCopyrightNotice: true}, 293 {Path: "store/types/ordered_sequences_diff_test.go", NomsPath: "go/types/ordered_sequences_diff_test.go", HadCopyrightNotice: true}, 294 {Path: "store/types/path.go", NomsPath: "go/types/path.go", HadCopyrightNotice: true}, 295 {Path: "store/types/path_test.go", NomsPath: "go/types/path_test.go", HadCopyrightNotice: true}, 296 {Path: "store/types/perf/dummy.go", NomsPath: "go/types/perf/dummy.go", HadCopyrightNotice: true}, 297 {Path: "store/types/perf/perf_test.go", NomsPath: "go/types/perf/perf_test.go", HadCopyrightNotice: true}, 298 {Path: "store/types/primitives_test.go", NomsPath: "go/types/primitives_test.go", HadCopyrightNotice: true}, 299 {Path: "store/types/ref.go", NomsPath: "go/types/ref.go", HadCopyrightNotice: true}, 300 {Path: "store/types/ref_heap.go", NomsPath: "go/types/ref_heap.go", HadCopyrightNotice: true}, 301 {Path: "store/types/ref_heap_test.go", NomsPath: "go/types/ref_heap_test.go", HadCopyrightNotice: true}, 302 {Path: "store/types/ref_test.go", NomsPath: "go/types/ref_test.go", HadCopyrightNotice: true}, 303 {Path: "store/types/rolling_value_hasher.go", NomsPath: "go/types/rolling_value_hasher.go", HadCopyrightNotice: true}, 304 {Path: "store/types/sequence.go", NomsPath: "go/types/sequence.go", HadCopyrightNotice: true}, 305 {Path: "store/types/sequence_chunker.go", NomsPath: "go/types/sequence_chunker.go", HadCopyrightNotice: true}, 306 {Path: "store/types/sequence_concat.go", NomsPath: "go/types/sequence_concat.go", HadCopyrightNotice: true}, 307 {Path: "store/types/sequence_cursor.go", NomsPath: "go/types/sequence_cursor.go", HadCopyrightNotice: true}, 308 {Path: "store/types/sequence_cursor_test.go", NomsPath: "go/types/sequence_cursor_test.go", HadCopyrightNotice: true}, 309 {Path: "store/types/set.go", NomsPath: "go/types/set.go", HadCopyrightNotice: true}, 310 {Path: "store/types/set_editor.go", NomsPath: "go/types/set_editor.go", HadCopyrightNotice: true}, 311 {Path: "store/types/set_iterator.go", NomsPath: "go/types/set_iterator.go", HadCopyrightNotice: true}, 312 {Path: "store/types/set_iterator_test.go", NomsPath: "go/types/set_iterator_test.go", HadCopyrightNotice: true}, 313 {Path: "store/types/set_leaf_sequence.go", NomsPath: "go/types/set_leaf_sequence.go", HadCopyrightNotice: true}, 314 {Path: "store/types/set_test.go", NomsPath: "go/types/set_test.go", HadCopyrightNotice: true}, 315 {Path: "store/types/string.go", NomsPath: "go/types/string.go", HadCopyrightNotice: true}, 316 {Path: "store/types/string_test.go", NomsPath: "go/types/string_test.go", HadCopyrightNotice: true}, 317 {Path: "store/types/struct.go", NomsPath: "go/types/struct.go", HadCopyrightNotice: true}, 318 {Path: "store/types/struct_test.go", NomsPath: "go/types/struct_test.go", HadCopyrightNotice: true}, 319 {Path: "store/types/subtype.go", NomsPath: "go/types/subtype.go", HadCopyrightNotice: true}, 320 {Path: "store/types/subtype_test.go", NomsPath: "go/types/subtype_test.go", HadCopyrightNotice: true}, 321 {Path: "store/types/type.go", NomsPath: "go/types/type.go", HadCopyrightNotice: true}, 322 {Path: "store/types/type_desc.go", NomsPath: "go/types/type_desc.go", HadCopyrightNotice: true}, 323 {Path: "store/types/type_test.go", NomsPath: "go/types/type_test.go", HadCopyrightNotice: true}, 324 {Path: "store/types/util_test.go", NomsPath: "go/types/util_test.go", HadCopyrightNotice: true}, 325 {Path: "store/types/validate_type.go", NomsPath: "go/types/validate_type.go", HadCopyrightNotice: true}, 326 {Path: "store/types/validating_decoder.go", NomsPath: "go/types/validating_decoder.go", HadCopyrightNotice: true}, 327 {Path: "store/types/validating_decoder_test.go", NomsPath: "go/types/validating_decoder_test.go", HadCopyrightNotice: true}, 328 {Path: "store/types/value.go", NomsPath: "go/types/value.go", HadCopyrightNotice: true}, 329 {Path: "store/types/value_decoder.go", NomsPath: "go/types/value_decoder.go", HadCopyrightNotice: true}, 330 {Path: "store/types/value_stats.go", NomsPath: "go/types/value_stats.go", HadCopyrightNotice: true}, 331 {Path: "store/types/value_store.go", NomsPath: "go/types/value_store.go", HadCopyrightNotice: true}, 332 {Path: "store/types/value_store_test.go", NomsPath: "go/types/value_store_test.go", HadCopyrightNotice: true}, 333 {Path: "store/types/walk.go", NomsPath: "go/types/walk.go", HadCopyrightNotice: true}, 334 {Path: "store/types/walk_refs.go", NomsPath: "go/types/walk_refs.go", HadCopyrightNotice: true}, 335 {Path: "store/types/walk_refs_test.go", NomsPath: "go/types/walk_refs_test.go", HadCopyrightNotice: true}, 336 {Path: "store/types/walk_test.go", NomsPath: "go/types/walk_test.go", HadCopyrightNotice: true}, 337 {Path: "store/util/clienttest/client_test_suite.go", NomsPath: "go/util/clienttest/client_test_suite.go", HadCopyrightNotice: true}, 338 {Path: "store/util/datetime/date_time.go", NomsPath: "go/util/datetime/date_time.go", HadCopyrightNotice: true}, 339 {Path: "store/util/datetime/date_time_test.go", NomsPath: "go/util/datetime/date_time_test.go", HadCopyrightNotice: true}, 340 {Path: "store/util/exit/exit.go", NomsPath: "go/util/exit/exit.go", HadCopyrightNotice: true}, 341 {Path: "store/util/functions/all.go", NomsPath: "go/util/functions/all.go", HadCopyrightNotice: true}, 342 {Path: "store/util/functions/all_test.go", NomsPath: "go/util/functions/all_test.go", HadCopyrightNotice: true}, 343 {Path: "store/util/outputpager/page_output.go", NomsPath: "go/util/outputpager/page_output.go", HadCopyrightNotice: true}, 344 {Path: "store/util/profile/profile.go", NomsPath: "go/util/profile/profile.go", HadCopyrightNotice: true}, 345 {Path: "store/util/progressreader/reader.go", NomsPath: "go/util/progressreader/reader.go", HadCopyrightNotice: true}, 346 {Path: "store/util/sizecache/size_cache.go", NomsPath: "go/util/sizecache/size_cache.go", HadCopyrightNotice: true}, 347 {Path: "store/util/sizecache/size_cache_test.go", NomsPath: "go/util/sizecache/size_cache_test.go", HadCopyrightNotice: true}, 348 {Path: "store/util/status/status.go", NomsPath: "go/util/status/status.go", HadCopyrightNotice: true}, 349 {Path: "store/util/test/equals_ignore_hashes.go", NomsPath: "go/util/test/equals_ignore_hashes.go", HadCopyrightNotice: true}, 350 {Path: "store/util/verbose/verbose.go", NomsPath: "go/util/verbose/verbose.go", HadCopyrightNotice: true}, 351 {Path: "store/util/writers/max_line_writer.go", NomsPath: "go/util/writers/max_line_writer.go", HadCopyrightNotice: true}, 352 {Path: "store/util/writers/prefix_writer.go", NomsPath: "go/util/writers/prefix_writer.go", HadCopyrightNotice: true}, 353 {Path: "store/util/writers/writers_test.go", NomsPath: "go/util/writers/writers_test.go", HadCopyrightNotice: true}, 354 } 355 356 // Attempt to enforce some simple copyright header standards on some 357 // directories in the repository. 358 // The rules: 359 // - Every .go file in //go that is not a .pb.go file and that did not 360 // come from noms must have ExpectedHeader. 361 // - Every .go file in //go that came from noms and whose file in noms 362 // had a copyright notice must have ExpectedHeaderForFileFromNoms. 363 // - Every .proto file in //proto must have ExpectedHeader. 364 365 func main() { 366 failed := CheckGo() 367 failed = CheckProto() || failed 368 if failed { 369 os.Exit(1) 370 } 371 } 372 373 func CheckGo() bool { 374 nomsLookup := make(map[string]*CopiedNomsFile) 375 for i := range CopiedNomsFiles { 376 nomsLookup[CopiedNomsFiles[i].Path] = &CopiedNomsFiles[i] 377 } 378 var failed bool 379 filepath.Walk(".", func(path string, info os.FileInfo, err error) error { 380 if strings.HasSuffix(path, ".go") && !strings.HasSuffix(path, ".pb.go") { 381 info := nomsLookup[path] 382 hasNomsHeader := info != nil && info.HadCopyrightNotice 383 if info != nil { 384 delete(nomsLookup, path) 385 } 386 f, err := os.Open(path) 387 if err != nil { 388 panic(err) 389 } 390 defer f.Close() 391 bs, err := ioutil.ReadAll(f) 392 if err != nil { 393 panic(err) 394 } 395 var passes bool 396 if hasNomsHeader { 397 passes = ExpectedHeaderForFileFromNoms.Match(bs) 398 } else { 399 passes = ExpectedHeader.Match(bs) 400 } 401 if !passes { 402 fmt.Printf("ERROR: Wrong copyright header: %v\n", path) 403 failed = true 404 } 405 } 406 return nil 407 }) 408 for path, _ := range nomsLookup { 409 fmt.Printf("ERROR: Missing noms file from CopiedNomsFiles: %v\n", path) 410 fmt.Printf(" Please update with new location or remove the reference in ./utils/copyrightshdrs/") 411 failed = true 412 } 413 return failed 414 } 415 416 func CheckProto() bool { 417 var failed bool 418 filepath.Walk("../proto", func(path string, info os.FileInfo, err error) error { 419 if strings.HasSuffix(path, ".proto") { 420 f, err := os.Open(path) 421 if err != nil { 422 panic(err) 423 } 424 defer f.Close() 425 bs, err := ioutil.ReadAll(f) 426 if err != nil { 427 panic(err) 428 } 429 passes := ExpectedHeader.Match(bs) 430 if !passes { 431 fmt.Printf("ERROR: Wrong copyright header: %v\n", path) 432 failed = true 433 } 434 } else if strings.HasPrefix(path, "../proto/third_party") { 435 return filepath.SkipDir 436 } 437 return nil 438 }) 439 return failed 440 }