aboutsummaryrefslogtreecommitdiff
path: root/build.go
diff options
context:
space:
mode:
authorSimon Frei <freisim93@gmail.com>2021-03-03 08:53:50 +0100
committerGitHub <noreply@github.com>2021-03-03 08:53:50 +0100
commit3d91f7c975a862be418afa43f5ca366f6e1dbd2b (patch)
treece415ddd1c2d0e95c2d23efcd955ec769bee6679 /build.go
parent7945430e64d885a848887ce1a9231551067cebe7 (diff)
downloadsyncthing-3d91f7c975a862be418afa43f5ca366f6e1dbd2b.tar.gz
syncthing-3d91f7c975a862be418afa43f5ca366f6e1dbd2b.zip
lib: Use counterfeiter to mock interfaces in tests (#7375)
Diffstat (limited to 'build.go')
-rw-r--r--build.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/build.go b/build.go
index 7b8b4e81a..3b18c61e6 100644
--- a/build.go
+++ b/build.go
@@ -316,6 +316,9 @@ func runCommand(cmd string, target target) {
case "proto":
proto()
+ case "testmocks":
+ testmocks()
+
case "translate":
translate()
@@ -862,10 +865,26 @@ func proto() {
}
runPrintInDir(path, "git", "checkout", dep.commit)
}
- runPrint(goCmd, "generate", "github.com/syncthing/syncthing/lib/...", "github.com/syncthing/syncthing/cmd/stdiscosrv")
+ runPrint(goCmd, "generate", "github.com/syncthing/syncthing/cmd/stdiscosrv")
runPrint(goCmd, "generate", "proto/generate.go")
}
+func testmocks() {
+ runPrint(goCmd, "get", "golang.org/x/tools/cmd/goimports")
+ runPrint(goCmd, "get", "github.com/maxbrunsfeld/counterfeiter/v6")
+ args := []string{
+ "generate",
+ "github.com/syncthing/syncthing/lib/config",
+ "github.com/syncthing/syncthing/lib/connections",
+ "github.com/syncthing/syncthing/lib/discover",
+ "github.com/syncthing/syncthing/lib/events",
+ "github.com/syncthing/syncthing/lib/logger",
+ "github.com/syncthing/syncthing/lib/model",
+ "github.com/syncthing/syncthing/lib/protocol",
+ }
+ runPrint(goCmd, args...)
+}
+
func translate() {
os.Chdir("gui/default/assets/lang")
runPipe("lang-en-new.json", goCmd, "run", "../../../../script/translate.go", "lang-en.json", "../../../")