mautrix / whatsapp

A Matrix-WhatsApp puppeting bridge
https://maunium.net/go/mautrix-whatsapp
GNU Affero General Public License v3.0
1.21k stars 170 forks source link

After updating go version from go1.20.X to go1.22.3 - Error #697

Closed Bala0909 closed 1 month ago

Bala0909 commented 1 month ago

I tried to run "./build.sh" Under /opt/mautrix-whatsapp. Below error is prompted.

maunium.net/go/mautrix-whatsapp/database database/backfillqueue.go:34:6: BackfillType redeclared in this block database/backfill.go:34:6: other declaration of BackfillType database/backfillqueue.go:37:2: BackfillImmediate redeclared in this block database/backfill.go:37:2: other declaration of BackfillImmediate database/backfillqueue.go:38:2: BackfillForward redeclared in this block database/backfill.go:38:2: other declaration of BackfillForward database/backfillqueue.go:39:2: BackfillDeferred redeclared in this block database/backfill.go:39:2: other declaration of BackfillDeferred database/backfillqueue.go:42:24: method BackfillType.String already declared at database/backfill.go:42:24 database/backfillstate.go:27:22: BackfillState does not satisfy dbutil.DataStruct[BackfillState] (wrong type for method Scan) have Scan(dbutil.Scannable) BackfillState want Scan(dbutil.Scannable) (BackfillState, error) database/backfillstate.go:67:6: BackfillState redeclared in this block database/backfill.go:285:6: other declaration of BackfillState database/backfillstate.go:77:25: method BackfillState.Scan already declared at database/backfill.go:297:25 database/backfillstate.go:87:25: method BackfillState.Upsert already declared at database/backfill.go:308:25 database/backfillstate.go:91:25: method BackfillState.SetProcessingBatch already declared at database/backfill.go:324:25 database/backfillstate.go:27:22: too many errors

I tried below command and no luck.

sudo rm -rf /usr/local/go go clean -modcache wget https://go.dev/dl/go1.22.3.linux-amd64.tar.gz tar -C /usr/local -xzf go1.22.3.linux-amd64.tar.gz

Can anyone help me to fix this issue.

tulir commented 1 month ago

That sounds like your local copy of the bridge sources is corrupted, likely caused by extracting a newer archive without removing old files. Using source archives like that isn't recommended in the first place, you should either use precompiled binaries or clone the repository with git.