From 36be7e6faa5ba583bc18351825c20db95d5dfda3 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Wed, 5 Sep 2018 16:54:43 +0930 Subject: [PATCH] travis: check for copyright headers --- .travis.yml | 3 +++ .travis/check-copyright.sh | 4 ++++ blas/gonum/level1doubleBench_auto_test.go | 4 ++-- .../benchautogen/autogen_bench_level1double.go | 18 +++++++----------- floats/examples_test.go | 2 +- floats/floats.go | 2 +- floats/floats_test.go | 2 +- graph/formats/dot/internal/paste_copyright.go | 10 ++++++++++ 8 files changed, 29 insertions(+), 16 deletions(-) create mode 100755 .travis/check-copyright.sh diff --git a/.travis.yml b/.travis.yml index 7935b4e1..364ca9ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,8 @@ before_install: - go get golang.org/x/tools/cmd/goimports # Required for imports check. - go get gonum.org/v1/tools/cmd/check-imports + # Required for copyright header check. + - go get gonum.org/v1/tools/cmd/check-copyright # Required for coverage. - go get golang.org/x/tools/cmd/cover - go get github.com/mattn/goveralls @@ -37,6 +39,7 @@ go_import_path: gonum.org/v1/gonum # Get deps, build, test, and ensure the code is gofmt'ed. # If we are building as gonum, then we have access to the coveralls api key, so we can run coverage as well. script: + - ${TRAVIS_BUILD_DIR}/.travis/check-copyright.sh - ${TRAVIS_BUILD_DIR}/.travis/check-formatting.sh - go get -d -t -v ./... - go build -v ./... diff --git a/.travis/check-copyright.sh b/.travis/check-copyright.sh new file mode 100755 index 00000000..209dca39 --- /dev/null +++ b/.travis/check-copyright.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +set -e +check-copyright -notice "Copyright ©20[0-9]{2} The Gonum Authors\. All rights reserved\." diff --git a/blas/gonum/level1doubleBench_auto_test.go b/blas/gonum/level1doubleBench_auto_test.go index 95c7a92a..0b870a97 100644 --- a/blas/gonum/level1doubleBench_auto_test.go +++ b/blas/gonum/level1doubleBench_auto_test.go @@ -1,6 +1,6 @@ -// Code generated by "go run github.com/gonum/blas/testblas/benchautogen/autogen_bench_level1double.go"; DO NOT EDIT. +// Code generated by "go run gonum.org/v1/gonum/blas/testblas/benchautogen/autogen_bench_level1double.go"; DO NOT EDIT. -// Copyright 2014 The Gonum Authors. All rights reserved. +// Copyright ©2014 The Gonum Authors. All rights reserved. // Use of this code is governed by a BSD-style // license that can be found in the LICENSE file diff --git a/blas/testblas/benchautogen/autogen_bench_level1double.go b/blas/testblas/benchautogen/autogen_bench_level1double.go index 4f9e9e64..54e1ca8b 100644 --- a/blas/testblas/benchautogen/autogen_bench_level1double.go +++ b/blas/testblas/benchautogen/autogen_bench_level1double.go @@ -1,4 +1,4 @@ -// Copyright 2014 The Gonum Authors. All rights reserved. +// Copyright ©2014 The Gonum Authors. All rights reserved. // Use of this code is governed by a BSD-style // license that can be found in the LICENSE file @@ -9,14 +9,13 @@ import ( "fmt" "os" "os/exec" - "path" "path/filepath" "strconv" ) var gopath string -var copyrightnotice = []byte(`// Copyright 2014 The Gonum Authors. All rights reserved. +var copyrightnotice = []byte(`// Copyright ©2014 The Gonum Authors. All rights reserved. // Use of this code is governed by a BSD-style // license that can be found in the LICENSE file`) @@ -180,18 +179,16 @@ func init() { } func main() { - blasPath := filepath.Join(gopath, "src", "gonum.org", "v1", "gonum", "blas") - - pkgs := []struct{ name string }{{name: "native"}, {name: "cgo"}} - + pkgs := []string{"gonum", "netlib"} for _, pkg := range pkgs { - err := level1(filepath.Join(blasPath, pkg.name), pkg.name) + blasPath := filepath.Join(gopath, "src", "gonum.org", "v1", pkg, "blas", pkg) + err := level1(blasPath, pkg) if err != nil { fmt.Println(err) os.Exit(1) } - err = exec.Command("go", "fmt", path.Join("gonum.org", "v1", "gonum", "blas", pkg.name)).Run() + err = exec.Command("goimports", "-w", blasPath).Run() if err != nil { fmt.Println(err) os.Exit(1) @@ -219,8 +216,7 @@ func level1(benchPath string, pkgname string) error { level1Filepath := filepath.Join(benchPath, "level1doubleBench_auto_test.go") f, err := os.Create(level1Filepath) if err != nil { - fmt.Println(err) - os.Exit(1) + return err } defer f.Close() printHeader(f, pkgname) diff --git a/floats/examples_test.go b/floats/examples_test.go index 3bc59ad1..9145a903 100644 --- a/floats/examples_test.go +++ b/floats/examples_test.go @@ -1,4 +1,4 @@ -// Copyright 2013 The Gonum Authors. All rights reserved. +// Copyright ©2013 The Gonum Authors. All rights reserved. // Use of this code is governed by a BSD-style // license that can be found in the LICENSE file diff --git a/floats/floats.go b/floats/floats.go index 3f3c6232..76d6c77c 100644 --- a/floats/floats.go +++ b/floats/floats.go @@ -1,4 +1,4 @@ -// Copyright 2013 The Gonum Authors. All rights reserved. +// Copyright ©2013 The Gonum Authors. All rights reserved. // Use of this code is governed by a BSD-style // license that can be found in the LICENSE file diff --git a/floats/floats_test.go b/floats/floats_test.go index 9eb559b2..270ddff4 100644 --- a/floats/floats_test.go +++ b/floats/floats_test.go @@ -1,4 +1,4 @@ -// Copyright 2013 The Gonum Authors. All rights reserved. +// Copyright ©2013 The Gonum Authors. All rights reserved. // Use of this code is governed by a BSD-style // license that can be found in the LICENSE file diff --git a/graph/formats/dot/internal/paste_copyright.go b/graph/formats/dot/internal/paste_copyright.go index fa346e80..d4dd0fb3 100644 --- a/graph/formats/dot/internal/paste_copyright.go +++ b/graph/formats/dot/internal/paste_copyright.go @@ -1,3 +1,13 @@ +// This file is dual licensed under CC0 and The gonum license. +// +// Copyright ©2017 The Gonum Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// Copyright ©2017 Robin Eklind. +// This file is made available under a Creative Commons CC0 1.0 +// Universal Public Domain Dedication.`) + // +build ignore package main