Unable to build from source

Trying to follow instructions @ Build Duplicacy from source, but nothing works.

Using documented command:

% go get -u github.com/gilbertchen/duplicacy/...
go: go.mod file not found in current directory or any parent directory.
	'go get' is no longer supported outside a module.
	To build and install a command, use 'go install' with a version,
	like 'go install example.com/cmd@latest'
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.

Trying using go install:

% go install github.com/gilbertchen/duplicacy/duplicacy@v2.7.2
...
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:124:27: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:249:27: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:381:28: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:392:28: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:404:29: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:414:29: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:548:27: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:641:27: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:734:27: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:795:27: context.App.Writer undefined (type *cli.App has no field or method Writer)
pkg/mod/github.com/gilbertchen/duplicacy@v2.7.2+incompatible/duplicacy/duplicacy_main.go:795:27: too many errors

By cloning:

% export GOPATH=$PWD
% mkdir -p github.com/gilbertchen
% cd github.com/gilbertchen
% go build duplicacy/duplicacy_main.go
duplicacy_main.go:23:2: no required module provides package github.com/gilbertchen/cli: go.mod file not found in current directory or any parent directory; see 'go help modules'
duplicacy_main.go:27:2: no required module provides package github.com/gilbertchen/duplicacy/src: go.mod file not found in current directory or any parent directory; see 'go help modules'

Trying to build AUR package:

src/cloud.google.com/go/storage/bucket.go:1764:17: undefined: storage.Bucket_IamConfig_INHERITED
src/cloud.google.com/go/storage/bucket.go:1764:55: undefined: storage.Bucket_IamConfig_PUBLIC_ACCESS_PREVENTION_UNSPECIFIED
src/cloud.google.com/go/storage/bucket.go:1766:17: undefined: storage.Bucket_IamConfig_ENFORCED

Turn off modules.

GO111MODULE=off go get -u github.com/gilbertchen/duplicacy/...

The build still fails in the same way as the AUR package:

go/src/cloud.google.com/go/storage/bucket.go:1764:17: undefined: storage.Bucket_IamConfig_INHERITED              
go/src/cloud.google.com/go/storage/bucket.go:1764:55: undefined: storage.Bucket_IamConfig_PUBLIC_ACCESS_PREVENTION_UNSPECIFIED
go/src/cloud.google.com/go/storage/bucket.go:1766:17: undefined: storage.Bucket_IamConfig_ENFORCED

This is what I did just now, on a machine that had not go installed, and it worked. See if you are doing anything differently, or maybe you have conflicting version of libraries.


% brew install go
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> New Casks
warp
==> Updated Casks
Updated 54 casks.

==> Downloading https://[censored]/brew-bottles-core-binaries-local/homebrew-core/go/06b11133/go-1.18.big_sur.bottle.1.ta
######################################################################## 100.0%
==> Pouring go-1.18.big_sur.bottle.1.tar.gz
🍺  /opt/brew/Cellar/go/1.18: 11,947 files, 592.6MB
==> Running `brew cleanup go`...

% go version
go version go1.18 darwin/amd64

% GO111MODULE=off go get -u github.com/gilbertchen/duplicacy/...
# github.com/gilbertchen/duplicacy/src
../../../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_swiftstorage.go:132:8: not enough arguments in call to connection.Authenticate
	have ()
	want ("context".Context)
../../../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_swiftstorage.go:137:35: not enough arguments in call to connection.Container
	have (string)
	want ("context".Context, string)
../../../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_swiftstorage.go:171:67: not enough arguments in call to storage.connection.ObjectsAll
	have (string, *swift.ObjectsOpts)
	want ("context".Context, string, *swift.ObjectsOpts)
../../../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_swiftstorage.go:193:60: not enough arguments in call to storage.connection.ObjectDelete
	have (string, string)
	want ("context".Context, string, string)
../../../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_swiftstorage.go:199:22: not enough arguments in call to storage.connection.ObjectMove
	have (string, string, string, string)
	want ("context".Context, string, string, string, string)
../../../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_swiftstorage.go:210:65: not enough arguments in call to storage.connection.Object
	have (string, string)
	want ("context".Context, string, string)
../../../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_swiftstorage.go:226:103: not enough arguments in call to storage.connection.ObjectOpen
	have (string, string, bool, nil)
	want ("context".Context, string, string, bool, swift.Headers)
../../../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_swiftstorage.go:237:131: not enough arguments in call to storage.connection.ObjectPut
	have (string, string, *RateLimitedReader, bool, string, string, nil)
	want ("context".Context, string, string, io.Reader, bool, string, string, swift.Headers)


% cd ~/go/src/github.com/ncw/swift
% git checkout tags/v1.0.50
Note: switching to 'tags/v1.0.50'.

HEAD is now at 3e1a09f Add Brandon WELSCH to contributors

% cd ~/go
% GO111MODULE=off go install github.com/gilbertchen/duplicacy/duplicacy
% ~/go/bin/duplicacy
NAME:
   duplicacy - A new generation cloud backup tool based on lock-free deduplication

USAGE:
   duplicacy [global options] command [command options] [arguments...]

VERSION:
   2.7.2 (unofficial)

COMMANDS:
   init		Initialize the storage if necessary and the current directory as the repository
   backup	Save a snapshot of the repository to the storage
   restore	Restore the repository to a previously saved snapshot
   list		List snapshots
   check	Check the integrity of snapshots
   cat		Print to stdout the specified file, or the snapshot content if no file is specified
   diff		Compare two snapshots or two revisions of a file
   history	Show the history of a file
   prune	Prune snapshots by revision, tag, or retention policy
   password	Change the storage password
   add		Add an additional storage to be used for the existing repository
   set		Change the options for the default or specified storage
   copy		Copy snapshots between compatible storages
   info		Show the information about the specified storage
   benchmark	Run a set of benchmarks to test download and upload speeds
   help, h	Shows a list of commands or help for one command

GLOBAL OPTIONS:
   -verbose, -v 		show more detailed information
   -debug, -d 			show even more detailed information, useful for debugging
   -log 			enable log-style output
   -stack 			print the stack trace when an error occurs
   -no-script 			do not run script before or after command execution
   -background 			read passwords, tokens, or keys only from keychain/keyring or env
   -profile <address:port> 	enable the profiling tool and listen on the specified address:port
   -comment  			add a comment to identify the process
   -suppress, -s <id> [+]	suppress logs with the specified id
   -print-memory-usage 		print memory usage every second
   -help, -h 			show help


I merged the PR by @mfeit_duplicacy and now you should be able to build it directly without the need to use swift v1.