diff --git a/.deepsource.toml b/.deepsource.toml index db824ada9..ab2662a58 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -7,4 +7,5 @@ name = "go" enabled = true [analyzers.meta] - import_paths = ["github.com/syncthing/syncthing"] \ No newline at end of file + import_paths = ["github.com/syncthing/syncthing"] + build_tags = ["noassets"] diff --git a/cmd/strelaypoolsrv/auto/noassets.go b/cmd/strelaypoolsrv/auto/noassets.go new file mode 100644 index 000000000..f8fa5e06d --- /dev/null +++ b/cmd/strelaypoolsrv/auto/noassets.go @@ -0,0 +1,15 @@ +// Copyright (C) 2021 The Syncthing Authors. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. + +//+build noassets + +package auto + +import "github.com/syncthing/syncthing/lib/assets" + +func Assets() map[string]assets.Asset { + return nil +} diff --git a/lib/api/auto/noassets.go b/lib/api/auto/noassets.go new file mode 100644 index 000000000..06e726c09 --- /dev/null +++ b/lib/api/auto/noassets.go @@ -0,0 +1,32 @@ +// Copyright (C) 2021 The Syncthing Authors. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. + +//+build noassets + +package auto + +import ( + "bytes" + "compress/gzip" + + "github.com/syncthing/syncthing/lib/assets" +) + +func Assets() map[string]assets.Asset { + // Return a minimal index.html and nothing else, to allow the trivial + // test to pass. + + buf := new(bytes.Buffer) + gw := gzip.NewWriter(buf) + _, _ = gw.Write([]byte("")) + _ = gw.Flush() + return map[string]assets.Asset{ + "default/index.html": { + Gzipped: true, + Content: buf.String(), + }, + } +}