diff --git a/gui/default/syncthing/core/aboutModalView.html b/gui/default/syncthing/core/aboutModalView.html index 8e82ba32f..d7d4b4445 100644 --- a/gui/default/syncthing/core/aboutModalView.html +++ b/gui/default/syncthing/core/aboutModalView.html @@ -51,81 +51,57 @@ Jakob Borg, Audrius Butkevicius, Jesse Lucas, Simon Frei, Tomasz Wilczyński, Al
  • The Go Programming Language, Copyright © 2009 The Go Authors.
  • Prometheus, Copyright © 2012-2015 The Prometheus Authors.
  • AudriusButkevicius/recli, Copyright © 2019 Audrius Butkevicius.
  • -
  • Azure/azure-sdk-for-go, Copyright © Microsoft Corporation.
  • Azure/go-ntlmssp, Copyright © 2016 Microsoft.
  • alecthomas/kong, Copyright © 2018 Alec Thomas.
  • -
  • aws/aws-sdk-go, Copyright © 2015 Amazon.com, Inc. or its affiliates, Copyright 2014-2015 Stripe, Inc.
  • beorn7/perks, Copyright © 2013 Blake Mizerany.
  • calmh/incontainer, Copyright © 2022 calmh.
  • calmh/xdr, Copyright © 2014 Jakob Borg.
  • ccding/go-stun, Copyright © 2016 Cong Ding.
  • -
  • cenkalti/backoff, Copyright © 2014 Cenk Altı.
  • -
  • certifi/gocertifi, Copyright © 2025, the certifi/gocertifi authors.
  • -
  • cespare/xxhash, Copyright © 2016 Caleb Spare.
  • +
  • cespare/xxhash/v2, Copyright © 2016 Caleb Spare.
  • chmduquesne/rollinghash, Copyright © 2015 Christophe-Marie Duquesne.
  • -
  • cpuguy83/go-md2man, Copyright © 2014 Brian Goff.
  • -
  • d4l3k/messagediff, Copyright © 2015 Tristan Rice.
  • -
  • davecgh/go-spew, Copyright © 2012-2016 Dave Collins .
  • +
  • cpuguy83/go-md2man/v2, Copyright © 2014 Brian Goff.
  • +
  • davecgh/go-spew, Copyright © 2012-2016 Dave Collins.
  • ebitengine/purego, Copyright © 2022 The Ebitengine Authors.
  • -
  • fsnotify/fsnotify, Copyright © 2012 The Go Authors.
  • -
  • getsentry/raven-go, Copyright © 2013 Apollic Software, LLC.
  • go-asn1-ber/asn1-ber, Copyright © 2011-2015 Michael Mitton (mmitton@gmail.com).
  • go-ldap/ldap, Copyright © 2011-2015 Michael Mitton (mmitton@gmail.com).
  • -
  • go-ole/go-ole, Copyright © 2013-2017 Yasuhiro Matsumoto, .
  • -
  • go-task/slim-sprig, Copyright © 2013-2020 Masterminds.
  • go.uber.org/automaxprocs, Copyright © 2017 Uber Technologies, Inc.
  • -
  • go.uber.org/mock, Copyright © 2010-2022 Google LLC.
  • gobwas/glob, Copyright © 2016 Sergey Kamardin.
  • gofrs/flock, Copyright © 2018-2025, The Gofrs.
  • golang/snappy, Copyright © 2011 The Snappy-Go Authors.
  • google.golang.org/protobuf, Copyright © 2018 The Go Authors.
  • -
  • google/pprof, Copyright © 2016 Google Inc.
  • google/uuid, Copyright © 2009,2014 Google Inc.
  • -
  • gopkg.in/yaml.v3, Copyright © 2006-2010 Kirill Simonov.
  • +
  • gopkg.in/yaml.v3, Copyright © 2025, the gopkg.in/yaml.v3 authors.
  • greatroar/blobloom, Copyright © 2020-2024 the Blobloom authors.
  • hashicorp/errwrap, Copyright © 2014 HashiCorp, Inc.
  • hashicorp/go-multierror, Copyright © 2014 HashiCorp, Inc.
  • hashicorp/golang-lru, Copyright © 2014 HashiCorp, Inc.
  • jackpal/gateway, Copyright © 2010 Jack Palevich.
  • jackpal/go-nat-pmp, Copyright 2013 John Howard Palevich.
  • -
  • jmespath/go-jmespath, Copyright © 2015 James Saryerwinnie.
  • julienschmidt/httprouter, Copyright © 2013, Julien Schmidt.
  • kballard/go-shellquote, Copyright © 2014 Kevin Ballard.
  • klauspost/compress, Copyright © 2012 The Go Authors.
  • -
  • lufia/plan9stats, Copyright © 2019, KADOTA, Kyohei.
  • -
  • maruel/panicparse, Copyright 2015 Marc-Antoine Ruel.
  • -
  • maxbrunsfeld/counterfeiter, Copyright © 2014 maxbrunsfeld.
  • -
  • maxmind/geoipupdate, Copyright © 2018-2024 by MaxMind, Inc.
  • miscreant/miscreant.go, Copyright © 2017-2019 The Miscreant Developers.
  • munnerz/goautoneg, Copyright © 2011, Open Knowledge Foundation Ltd.
  • -
  • nxadm/tail, Copyright © 2014 ActiveState.
  • -
  • onsi/ginkgo, Copyright © 2013-2014 Onsi Fakhouri.
  • -
  • oschwald/geoip2-golang, Copyright © 2015, Gregory J. Oschwald.
  • -
  • oschwald/maxminddb-golang, Copyright © 2015, Gregory J. Oschwald.
  • pierrec/lz4, Copyright © 2015 Pierre Curto.
  • pkg/errors, Copyright © 2015, Dave Cheney.
  • pmezard/go-difflib, Copyright © 2013, Patrick Mezard.
  • posener/complete, Copyright © 2017 Eyal Posener.
  • -
  • power-devops/perfstat, Copyright © 2020 Power DevOps.
  • -
  • puzpuzpuz/xsync, Copyright © 2025, the puzpuzpuz/xsync authors.
  • +
  • prometheus/client_golang, Copyright 2012-2015 The Prometheus Authors.
  • +
  • prometheus/client_model, Copyright © 2025, the prometheus/client_model authors.
  • +
  • prometheus/common, Copyright © 2025, the prometheus/common authors.
  • quic-go/quic-go, Copyright © 2016 the quic-go authors & Google, Inc.
  • -
  • rabbitmq/amqp091-go, Copyright © 2021 VMware, Inc. or its affiliates.
  • rcrowley/go-metrics, Copyright © 2012 Richard Crowley.
  • riywo/loginshell, Copyright © 2019 Ryosuke IWANAGA.
  • -
  • russross/blackfriday, Copyright © 2011 Russ Ross.
  • +
  • russross/blackfriday/v2, Copyright © 2011 Russ Ross.
  • shirou/gopsutil, Copyright © 2014, WAKAYAMA Shirou.
  • -
  • sigs.k8s.io/yaml, Copyright © 2014 Sam Ghods.
  • stretchr/objx, Copyright © 2014 Stretchr, Inc.
  • stretchr/testify, Copyright © 2012-2020 Mat Ryer, Tyler Bunnell and contributors.
  • -
  • syncthing/notify, Copyright © 2014-2015 The Notify Authors.
  • syndtr/goleveldb, Copyright © 2012 Suryandaru Triandana.
  • thejerf/suture, Copyright © 2014-2015 Barracuda Networks, Inc.
  • tklauser/go-sysconf, Copyright © 2018-2022, Tobias Klauser.
  • -
  • tklauser/numcpus, Copyright © 2018-2024 Tobias Klauser.
  • urfave/cli, Copyright © 2016 Jeremy Saenz & Contributors.
  • vitrun/qart, Copyright © 2010-2011 The Go Authors.
  • willabides/kongplete, Copyright © 2020 WillAbides.
  • -
  • yusufpapurcu/wmi, Copyright © 2013 Stack Exchange.
  • diff --git a/script/copyrights.go b/script/copyrights.go index f192893c2..d0f171a72 100644 --- a/script/copyrights.go +++ b/script/copyrights.go @@ -13,8 +13,6 @@ package main import ( - "bufio" - "bytes" "encoding/base64" "encoding/json" "fmt" @@ -50,6 +48,8 @@ var copyrightMap = map[string]string{ "jmespath/go-jmespath": "Copyright © 2015 James Saryerwinnie", // https://github.com/maxmind/geoipupdate/blob/main/README.md?plain=1#L140 "maxmind/geoipupdate": "Copyright © 2018-2024 by MaxMind, Inc", + // https://github.com/search?q=repo%3Aprometheus%2Fclient_golang%20copyright&type=code + "prometheus/client_golang": "Copyright 2012-2015 The Prometheus Authors", // https://github.com/search?q=repo%3Apuzpuzpuz%2Fxsync%20copyright&type=code // "puzpuzpuz/xsync": "No copyrights found", // https://github.com/search?q=repo%3Atklauser%2Fnumcpus%20copyright&type=code @@ -59,13 +59,13 @@ var copyrightMap = map[string]string{ } var urlMap = map[string]string{ - "fontawesome.io": "https://github.com/FortAwesome/Font-Awesome", - "go.uber.org/automaxprocs": "https://github.com/uber-go/automaxprocs", - "go.uber.org/mock": "https://github.com/uber-go/mock", + "fontawesome.io": "https://github.com/FortAwesome/Font-Awesome", + "go.uber.org/automaxprocs": "https://github.com/uber-go/automaxprocs", + // "go.uber.org/mock": "https://github.com/uber-go/mock", "google.golang.org/protobuf": "https://github.com/protocolbuffers/protobuf-go", - "gopkg.in/yaml.v2": "", // ignore, as gopkg.in/yaml.v3 supersedes - "gopkg.in/yaml.v3": "https://github.com/go-yaml/yaml", - "sigs.k8s.io/yaml": "https://github.com/kubernetes-sigs/yaml", + // "gopkg.in/yaml.v2": "", // ignore, as gopkg.in/yaml.v3 supersedes + // "gopkg.in/yaml.v3": "https://github.com/go-yaml/yaml", + "sigs.k8s.io/yaml": "https://github.com/kubernetes-sigs/yaml", } const htmlFile = "gui/default/syncthing/core/aboutModalView.html" @@ -174,6 +174,7 @@ func main() { if n.Type != TypeNew { continue } + copyright, ok := copyrightMap[n.Name] if ok { notices[i].Copyright = copyright @@ -272,44 +273,43 @@ func writeFile(path string, data string) { } func getModules() []string { - cmd := exec.Command("go", "mod", "graph") - output, err := cmd.Output() + ignoreRe := regexp.MustCompile(`golang\.org/x/|github\.com/syncthing|^[^.]+(/|$)`) + + // List all modules (used for mapping packages to modules) + data, err := exec.Command("go", "list", "-m", "all").Output() if err != nil { - log.Fatal(err) + log.Fatalf("go list -m all: %v", err) } + modules := strings.Split(string(data), "\n") + for i := range modules { + modules[i], _, _ = strings.Cut(modules[i], " ") + } + modules = slices.DeleteFunc(modules, func(s string) bool { return s == "" }) + + // List all packages in use by the syncthing binary, map them to modules + data, err = exec.Command("go", "list", "-deps", "./cmd/syncthing").Output() + if err != nil { + log.Fatalf("go list -deps ./cmd/syncthing: %v", err) + } + packages := strings.Split(string(data), "\n") + packages = slices.DeleteFunc(packages, func(s string) bool { return s == "" }) seen := make(map[string]struct{}) - scanner := bufio.NewScanner(bytes.NewReader(output)) - - for scanner.Scan() { - line := scanner.Text() - fields := strings.Fields(line) - if len(fields) == 0 { + for _, pkg := range packages { + if ignoreRe.MatchString(pkg) { continue } - if !strings.HasPrefix(fields[0], "github.com/syncthing/syncthing") { + // Find module for package + modIdx := slices.IndexFunc(modules, func(mod string) bool { + return strings.HasPrefix(pkg, mod) + }) + if modIdx < 0 { + log.Println("no module for", pkg) continue } - - // Get left-hand side of dependency pair (before '@') - mod := strings.SplitN(fields[1], "@", 2)[0] - - // Keep only first 3 path components - parts := strings.Split(mod, "/") - if len(parts) == 1 { - continue - } - short := strings.Join(parts[:min(len(parts), 3)], "/") - - if strings.HasPrefix(short, "golang.org/x") || - strings.HasPrefix(short, "github.com/prometheus") || - short == "go" { - - continue - } - - seen[short] = struct{}{} + module := modules[modIdx] + seen[module] = struct{}{} } adds := make([]string, 0) @@ -404,7 +404,9 @@ func getLicenseText(owner, repo string) string { log.Fatal(err) } defer resp.Body.Close() - + if resp.StatusCode == 404 { + return "" + } var result struct { Content string `json:"content"` Encoding string `json:"encoding"` @@ -416,7 +418,7 @@ func getLicenseText(owner, repo string) string { } if result.Encoding != "base64" { - log.Fatal(fmt.Sprintf("unexpected encoding: %s", result.Encoding)) + log.Fatal(fmt.Sprintf("unexpected encoding: %q", result.Encoding)) } decoded, err := base64.StdEncoding.DecodeString(result.Content)