diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a62979d..adaf7d39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,16 @@ on: branches: [ main ] jobs: + copyright: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - name: Verify File Headers + run: go run ./internal/copyright --verify-only coverage: runs-on: ubuntu-latest steps: diff --git a/LICENSE b/LICENSE index 126b8a91..0595c240 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,7 @@ MIT License +Copyright (c) 2022 Temporal Technologies Inc. All rights reserved. + Copyright (c) 2021 Datadog, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/LICENSE-3rdparty.csv b/LICENSE-3rdparty.csv deleted file mode 100755 index 53f089dd..00000000 --- a/LICENSE-3rdparty.csv +++ /dev/null @@ -1,135 +0,0 @@ -Component,Origin,License,Copyright -cloud.google.com/go/compute/metadata,,Apache-2.0, -cloud.google.com/go/iam,,Apache-2.0, -cloud.google.com/go/internal,,Apache-2.0, -cloud.google.com/go/storage,,Apache-2.0, -github.com/temporalio/temporalite,https://github.com/temporalio/temporalite,MIT,"Datadog, Inc." -github.com/apache/thrift/lib/go/thrift,https://github.com/apache/thrift,Apache-2.0, -github.com/aws/aws-sdk-go,https://github.com/aws/aws-sdk-go,Apache-2.0, -github.com/aws/aws-sdk-go/internal/sync/singleflight,https://github.com/aws/aws-sdk-go,BSD-3-Clause,The Go Authors -github.com/benbjohnson/clock,https://github.com/benbjohnson/clock,MIT,Ben Johnson -github.com/beorn7/perks/quantile,https://github.com/beorn7/perks,MIT,Blake Mizerany -github.com/blang/semver/v4,https://github.com/blang/semver,MIT,Benedikt Lang -github.com/cactus/go-statsd-client/statsd,https://github.com/cactus/go-statsd-client,MIT,Eli Janssen -github.com/cespare/xxhash/v2,https://github.com/cespare/xxhash,MIT,Caleb Spare -github.com/coreos/go-oidc/v3/oidc,https://github.com/coreos/go-oidc,Apache-2.0, -github.com/cpuguy83/go-md2man/v2/md2man,https://github.com/cpuguy83/go-md2man,MIT,Brian Goff -github.com/davecgh/go-spew/spew,https://github.com/davecgh/go-spew,ISC,Dave Collins -github.com/dgrijalva/jwt-go,https://github.com/dgrijalva/jwt-go,MIT,Dave Grijalva -github.com/dgryski/go-farm,https://github.com/dgryski/go-farm,MIT,Damian Gryski -github.com/emirpasic/gods,https://github.com/emirpasic/gods,BSD-2-Clause,Emir Pasic -github.com/facebookgo/clock,https://github.com/facebookgo/clock,MIT,Ben Johnson -github.com/go-logr/logr,https://github.com/go-logr/logr,Apache-2.0, -github.com/go-logr/stdr,https://github.com/go-logr/stdr,Apache-2.0, -github.com/gocql/gocql,https://github.com/gocql/gocql,BSD-3-Clause,The Gocql authors -github.com/gogo/gateway,https://github.com/gogo/gateway,BSD-3-Clause,"Gengo, Inc." -github.com/gogo/googleapis/google,https://github.com/gogo/googleapis,Apache-2.0,Google Inc -github.com/gogo/protobuf,https://github.com/gogo/protobuf,BSD-3-Clause,The GoGo Authors -github.com/gogo/status,https://github.com/gogo/status,Apache-2.0, -github.com/golang-jwt/jwt/v4,https://github.com/golang-jwt/jwt,MIT,Dave Grijalva -github.com/golang/glog,https://github.com/golang/glog,Apache-2.0, -github.com/golang/groupcache/lru,https://github.com/golang/groupcache,Apache-2.0, -github.com/golang/mock/gomock,https://github.com/golang/mock,Apache-2.0, -github.com/golang/protobuf,https://github.com/golang/protobuf,BSD-3-Clause,The Go Authors -github.com/golang/snappy,https://github.com/golang/snappy,BSD-3-Clause,The Snappy-Go Authors -github.com/google/go-cmp/cmp,https://github.com/google/go-cmp,BSD-3-Clause,The Go Authors -github.com/google/go-licenses/licenses,https://github.com/google/go-licenses,Apache-2.0, -github.com/google/licenseclassifier,https://github.com/google/licenseclassifier,Apache-2.0, -github.com/google/licenseclassifier/stringclassifier,https://github.com/google/licenseclassifier,Apache-2.0, -github.com/google/uuid,https://github.com/google/uuid,BSD-3-Clause,Google Inc. -github.com/googleapis/gax-go/v2,https://github.com/googleapis/gax-go,BSD-3-Clause,Google Inc. -github.com/gorilla/context,https://github.com/gorilla/context,BSD-3-Clause,Rodrigo Moraes -github.com/gorilla/securecookie,https://github.com/gorilla/securecookie,BSD-3-Clause,Rodrigo Moraes -github.com/gorilla/sessions,https://github.com/gorilla/sessions,BSD-3-Clause,The Gorilla Authors -github.com/grpc-ecosystem/go-grpc-middleware,https://github.com/grpc-ecosystem/go-grpc-middleware,Apache-2.0, -github.com/grpc-ecosystem/grpc-gateway,https://github.com/grpc-ecosystem/grpc-gateway,BSD-3-Clause,"Gengo, Inc." -github.com/hailocab/go-hostpool,https://github.com/hailocab/go-hostpool,MIT,Bitly -github.com/iancoleman/strcase,https://github.com/iancoleman/strcase,MIT,Ian Coleman -github.com/jbenet/go-context/io,https://github.com/jbenet/go-context,MIT,Juan Batiz-Benet -github.com/jmespath/go-jmespath,https://github.com/jmespath/go-jmespath,Apache-2.0,James Saryerwinnie -github.com/jmoiron/sqlx,https://github.com/jmoiron/sqlx,MIT,Jason Moiron -github.com/jonboulle/clockwork,https://github.com/jonboulle/clockwork,Apache-2.0, -github.com/josharian/intern,https://github.com/josharian/intern,MIT,Josh Bleecher Snyder -github.com/kevinburke/ssh_config,https://github.com/kevinburke/ssh_config,MIT,Kevin Burke -github.com/labstack/echo-contrib/session,https://github.com/labstack/echo-contrib,MIT,LabStack -github.com/labstack/echo/v4,https://github.com/labstack/echo,MIT,LabStack -github.com/labstack/gommon,https://github.com/labstack/gommon,MIT,labstack -github.com/mailru/easyjson,https://github.com/mailru/easyjson,MIT,Mail.Ru Group -github.com/mattn/go-colorable,https://github.com/mattn/go-colorable,MIT,Yasuhiro Matsumoto -github.com/mattn/go-isatty,https://github.com/mattn/go-isatty,MIT, -github.com/mattn/go-sqlite3,https://github.com/mattn/go-sqlite3,MIT,Yasuhiro Matsumoto -github.com/matttproud/golang_protobuf_extensions/pbutil,https://github.com/matttproud/golang_protobuf_extensions,Apache-2.0, -github.com/mitchellh/go-homedir,https://github.com/mitchellh/go-homedir,MIT,Mitchell Hashimoto -github.com/olivere/elastic,https://github.com/olivere/elastic,MIT,Oliver Eilhard -github.com/olivere/elastic/uritemplates,https://github.com/olivere/elastic,MIT,Joshua Tacoma -github.com/olivere/elastic/v7,https://github.com/olivere/elastic,MIT,Oliver Eilhard -github.com/olivere/elastic/v7/uritemplates,https://github.com/olivere/elastic,MIT,Joshua Tacoma -github.com/opentracing/opentracing-go,https://github.com/opentracing/opentracing-go,Apache-2.0,The OpenTracing Authors -github.com/pborman/uuid,https://github.com/pborman/uuid,BSD-3-Clause,Google Inc. -github.com/pkg/errors,https://github.com/pkg/errors,BSD-2-Clause,Dave Cheney -github.com/pmezard/go-difflib/difflib,https://github.com/pmezard/go-difflib,BSD-3-Clause,Patrick Mezard -github.com/prometheus/client_golang/prometheus,https://github.com/prometheus/client_golang,Apache-2.0, -github.com/prometheus/client_model/go,https://github.com/prometheus/client_model,Apache-2.0, -github.com/prometheus/common,https://github.com/prometheus/common,Apache-2.0, -github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg,https://github.com/prometheus/common,BSD-3-Clause,Open Knowledge Foundation Ltd -github.com/prometheus/procfs,https://github.com/prometheus/procfs,Apache-2.0, -github.com/rcrowley/go-metrics,https://github.com/rcrowley/go-metrics,BSD-2-Clause-FreeBSD,Richard Crowley -github.com/robfig/cron,https://github.com/robfig/cron,MIT,Rob Figueiredo -github.com/robfig/cron/v3,https://github.com/robfig/cron,MIT,Rob Figueiredo -github.com/russross/blackfriday/v2,https://github.com/russross/blackfriday,BSD-2-Clause,Russ Ross -github.com/sergi/go-diff/diffmatchpatch,https://github.com/sergi/go-diff,MIT,The go-diff Authors -github.com/sirupsen/logrus,https://github.com/sirupsen/logrus,MIT,Simon Eskildsen -github.com/src-d/gcfg,https://github.com/src-d/gcfg,BSD-3-Clause,Péter Surányi. Portions Copyright (c) 2009 The Go -github.com/stretchr/objx,https://github.com/stretchr/objx,MIT,"Stretchr, Inc." -github.com/stretchr/testify,https://github.com/stretchr/testify,MIT,"Mat Ryer, Tyler Bunnell and contributors" -github.com/temporalio/ringpop-go,https://github.com/temporalio/ringpop-go,MIT,"Uber Technologies, Inc." -github.com/temporalio/ui-server/server,https://github.com/temporalio/ui-server,MIT,Temporal Technologies Inc. -github.com/twmb/murmur3,https://github.com/twmb/murmur3,BSD-3-Clause,Sébastien Paolacci -github.com/uber-common/bark,https://github.com/uber-common/bark,MIT,"Uber Technologies, Inc." -github.com/uber-go/tally/v4,https://github.com/uber-go/tally,MIT,"Permission is hereby granted, free of charge, to any person obtaining a copy" -github.com/uber/tchannel-go,https://github.com/uber/tchannel-go,MIT,"Uber Technologies, Inc." -github.com/urfave/cli/v2,https://github.com/urfave/cli,MIT,Jeremy Saenz & Contributors -github.com/valyala/bytebufferpool,https://github.com/valyala/bytebufferpool,MIT,"Aliaksandr Valialkin, VertaMedia" -github.com/valyala/fasttemplate,https://github.com/valyala/fasttemplate,MIT,Aliaksandr Valialkin -github.com/xanzy/ssh-agent,https://github.com/xanzy/ssh-agent,Apache-2.0, -github.com/xwb1989/sqlparser,https://github.com/xwb1989/sqlparser,Apache-2.0, -go.opencensus.io,,Apache-2.0, -go.opentelemetry.io/otel,,Apache-2.0, -go.opentelemetry.io/otel/exporters/prometheus,,Apache-2.0, -go.opentelemetry.io/otel/internal/metric,,Apache-2.0, -go.opentelemetry.io/otel/metric,,Apache-2.0, -go.opentelemetry.io/otel/sdk,,Apache-2.0, -go.opentelemetry.io/otel/sdk/export/metric,,Apache-2.0, -go.opentelemetry.io/otel/sdk/metric,,Apache-2.0, -go.opentelemetry.io/otel/trace,,Apache-2.0, -go.temporal.io/api,,MIT,Temporal Technologies Inc. -go.temporal.io/sdk,,MIT,Temporal Technologies Inc. -go.temporal.io/server,,MIT,Temporal Technologies Inc. -go.temporal.io/version/check,,MIT,Temporal Technologies Inc. -go.uber.org/atomic,,MIT,"Uber Technologies, Inc." -go.uber.org/dig,,MIT,"Uber Technologies, Inc." -go.uber.org/fx,,MIT,"Uber Technologies, Inc." -go.uber.org/multierr,,MIT,"Uber Technologies, Inc." -go.uber.org/zap,,MIT,"Uber Technologies, Inc." -golang.org/x/crypto,,BSD-3-Clause,The Go Authors -golang.org/x/mod/semver,,BSD-3-Clause,The Go Authors -golang.org/x/net,,BSD-3-Clause,The Go Authors -golang.org/x/oauth2,,BSD-3-Clause,The Go Authors -golang.org/x/sys,,BSD-3-Clause,The Go Authors -golang.org/x/text,,BSD-3-Clause,The Go Authors -golang.org/x/time/rate,,BSD-3-Clause,The Go Authors -golang.org/x/tools,,BSD-3-Clause,The Go Authors -golang.org/x/xerrors,,BSD-3-Clause,The Go Authors -google.golang.org/api,,BSD-3-Clause,Google Inc. -google.golang.org/api/internal/third_party/uritemplates,,BSD-3-Clause,Joshua Tacoma -google.golang.org/genproto,,Apache-2.0, -google.golang.org/grpc,,Apache-2.0, -google.golang.org/protobuf,,BSD-3-Clause,The Go Authors -gopkg.in/inf.v0,,BSD-3-Clause,Péter Surányi. Portions Copyright (c) 2009 The Go -gopkg.in/square/go-jose.v2,,Apache-2.0, -gopkg.in/square/go-jose.v2/json,,BSD-3-Clause,The Go Authors -gopkg.in/src-d/go-billy.v4,,Apache-2.0,Sourced Technologies S.L -gopkg.in/src-d/go-git.v4,,Apache-2.0,"Sourced Technologies, S.L" -gopkg.in/validator.v2,,Apache-2.0, -gopkg.in/warnings.v0,,BSD-2-Clause,Péter Surányi -gopkg.in/yaml.v3,,MIT,Kirill Simonov diff --git a/cmd/temporalite/ui.go b/cmd/temporalite/ui.go index 2dcd4e29..008dea97 100644 --- a/cmd/temporalite/ui.go +++ b/cmd/temporalite/ui.go @@ -1,3 +1,7 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. +// +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. + //go:build !headless package main diff --git a/cmd/temporalite/ui_disabled.go b/cmd/temporalite/ui_disabled.go index d905a30a..249c1d02 100644 --- a/cmd/temporalite/ui_disabled.go +++ b/cmd/temporalite/ui_disabled.go @@ -1,3 +1,7 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. +// +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. + //go:build headless package main diff --git a/cmd/temporalite/ui_disabled_test.go b/cmd/temporalite/ui_disabled_test.go index e883d9f1..2c7111bc 100644 --- a/cmd/temporalite/ui_disabled_test.go +++ b/cmd/temporalite/ui_disabled_test.go @@ -1,3 +1,7 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. +// +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. + //go:build headless package main diff --git a/cmd/temporalite/ui_test.go b/cmd/temporalite/ui_test.go index 377a080e..182fd859 100644 --- a/cmd/temporalite/ui_test.go +++ b/cmd/temporalite/ui_test.go @@ -1,3 +1,7 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. +// +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. + //go:build !headless package main diff --git a/internal/copyright/header.txt b/internal/copyright/header.txt index 1c5724d1..6b139a2e 100644 --- a/internal/copyright/header.txt +++ b/internal/copyright/header.txt @@ -1,3 +1,5 @@ Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. +Copyright (c) 2022 Temporal Technologies Inc. All rights reserved. + This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. diff --git a/internal/copyright/main.go b/internal/copyright/main.go index 843aebfa..b4a5a305 100644 --- a/internal/copyright/main.go +++ b/internal/copyright/main.go @@ -32,6 +32,7 @@ import ( "flag" "fmt" "io/ioutil" + "log" "os" "path/filepath" "strings" @@ -53,11 +54,7 @@ type ( } ) -var ( - //go:embed header.txt - headerText string - headerPrefixes = []string{"The MIT License", "Unless explicitly stated"} -) +var headerPrefixes = []string{"The MIT License", "Unless explicitly stated"} var ( // directories to be excluded @@ -69,35 +66,45 @@ var ( // command line utility that adds license header // to the source files. Usage as follows: // -// ./cmd/tools/copyright/licensegen.go +// go run ./internal/copyright func main() { var cfg config - flag.StringVar(&cfg.scanDir, "scanDir", ".", "directory to scan") - flag.BoolVar(&cfg.verifyOnly, "verifyOnly", false, "don't automatically add headers, just verify all files") + flag.StringVar(&cfg.licenseFile, "header-file", "./LICENSE", "file containing copyright header content") + flag.StringVar(&cfg.scanDir, "scan-dir", ".", "directory to scan") + flag.BoolVar(&cfg.verifyOnly, "verify-only", false, "don't automatically add headers, just verify all files") flag.Parse() - task := newAddLicenseHeaderTask(&cfg) + task, err := newAddLicenseHeaderTask(&cfg) + if err != nil { + log.Fatal(err) + } if err := task.run(); err != nil { - fmt.Println(err) - os.Exit(-1) + fmt.Println("ERROR:", err) + fmt.Println("To fix missing copyright headers, execute the following command:\n go run ./internal/copyright") + os.Exit(1) } } -func newAddLicenseHeaderTask(cfg *config) *addLicenseHeaderTask { - return &addLicenseHeaderTask{ - config: cfg, +func newAddLicenseHeaderTask(cfg *config) (*addLicenseHeaderTask, error) { + b, err := os.ReadFile(cfg.licenseFile) + if err != nil { + return nil, err } + return &addLicenseHeaderTask{ + license: string(b), + config: cfg, + }, nil } func (task *addLicenseHeaderTask) run() error { - license, err := commentOutLines(headerText) + license, err := commentOutLines(task.license) if err != nil { - return fmt.Errorf("copyright header failed to comment out lines, err=%v", err.Error()) + return fmt.Errorf("copyright header failed to comment out lines: %w", err) } task.license = license if err := filepath.Walk(task.config.scanDir, task.handleFile); err != nil { - return fmt.Errorf("copyright header check failed, err=%v", err.Error()) + return fmt.Errorf("copyright header check failed: %w", err) } return nil } diff --git a/internal/examples/helloworld/testinterceptor.go b/internal/examples/helloworld/testinterceptor.go index 29147ca7..4b3e782d 100644 --- a/internal/examples/helloworld/testinterceptor.go +++ b/internal/examples/helloworld/testinterceptor.go @@ -1,3 +1,7 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. +// +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. + package helloworld import ( diff --git a/internal/licensecheck/main.go b/internal/licensecheck/main.go deleted file mode 100644 index 9f0639ae..00000000 --- a/internal/licensecheck/main.go +++ /dev/null @@ -1,114 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. -// -// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. - -package main - -import ( - "context" - _ "embed" - "encoding/csv" - "encoding/json" - "io" - "log" - "os" - "sort" - "strings" - - "github.com/google/go-licenses/licenses" - "github.com/google/licenseclassifier" -) - -func main() { - if err := execute(); err != nil { - log.Fatal(err) - } -} - -type Component struct { - Origin string `json:"origin"` - License string `json:"license"` - Copyright string `json:"copyright"` -} - -//go:embed overrides.json -var componentOverrides []byte - -func execute() error { - classifier, err := licenses.NewClassifier(0.9) - if err != nil { - return err - } - - f, err := os.OpenFile("LICENSE-3rdparty.csv", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755) - if err != nil { - return err - } - defer f.Close() - - libs, err := licenses.Libraries(context.Background(), classifier, "./...") - if err != nil { - return err - } - - components := map[string]Component{} - var overrides map[string]Component - if err := json.Unmarshal(componentOverrides, &overrides); err != nil { - return err - } - - for _, lib := range libs { - var component Component - var licenseUrl string - if lib.LicensePath != "" { - // Parse copyright - if b, err := os.ReadFile(lib.LicensePath); err == nil { - component.Copyright = licenseclassifier.CopyrightHolder(string(b)) - } - // Parse license type - if ln, _, err := classifier.Identify(lib.LicensePath); err == nil { - component.License = ln - } - // Parse license URL - if lURL, err := lib.FileURL(lib.LicensePath); err == nil { - licenseUrl = lURL.String() - } - } - if licenseUrl != "" { - component.Origin = strings.Split(licenseUrl, "/blob/")[0] - } - - components[lib.Name()] = component - } - - for k, v := range overrides { - components[k] = v - } - - return writeComponents(f, components) -} - -func writeComponents(w io.Writer, components map[string]Component) error { - c := csv.NewWriter(w) - defer c.Flush() - - if err := c.Write([]string{"Component", "Origin", "License", "Copyright"}); err != nil { - return err - } - - // Sort component names - var keys []string - for k, _ := range components { - keys = append(keys, k) - } - sort.Strings(keys) - - for _, k := range keys { - component := components[k] - if err := c.Write([]string{k, component.Origin, component.License, component.Copyright}); err != nil { - return err - } - } - - return nil -} diff --git a/internal/licensecheck/overrides.json b/internal/licensecheck/overrides.json deleted file mode 100644 index 4878ee09..00000000 --- a/internal/licensecheck/overrides.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "github.com/cactus/go-statsd-client/statsd": { - "license": "MIT", - "copyright": "Eli Janssen", - "origin": "https://github.com/cactus/go-statsd-client" - } -}