Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.25.5

require (
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230731094759-d626e9ab09b9
github.com/hyperledger/fabric-contract-api-go v1.2.2
github.com/hyperledger/fabric-contract-api-go/v2 v2.2.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The Go module was updated to v2 in go.mod, but the import paths in .go files were not updated with the required /v2 suffix, which will cause a build failure.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The go.mod file was updated to use version 2 of the fabric-contract-api-go dependency, but the import paths in the source code were not updated accordingly. Go's Semantic Import Versioning requires that for major versions v2 and above, the import path must include the version suffix (e.g., /v2). The current code imports from the v1 path (github.com/hyperledger/fabric-contract-api-go/contractapi) while the go.mod file specifies the v2 module. This mismatch will cause a build failure because the compiler cannot resolve the specified imports.

💡 Suggested Fix

Update the import paths in src/assetTransfer.go, src/chaincode/smartcontract.go, and src/chaincode/smartcontract_test.go from "github.com/hyperledger/fabric-contract-api-go/contractapi" to "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" to match the module version.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/go.mod#L9

Potential issue: The `go.mod` file was updated to use version 2 of the
`fabric-contract-api-go` dependency, but the import paths in the source code were not
updated accordingly. Go's Semantic Import Versioning requires that for major versions v2
and above, the import path must include the version suffix (e.g., `/v2`). The current
code imports from the v1 path
(`github.com/hyperledger/fabric-contract-api-go/contractapi`) while the `go.mod` file
specifies the v2 module. This mismatch will cause a build failure because the compiler
cannot resolve the specified imports.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7530241

github.com/hyperledger/fabric-contract-api-go/v2 v2.2.0
Comment on lines +9 to 10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The go.mod file has a duplicate require entry for the fabric-contract-api-go/v2 module. This makes the file malformed and can cause build tool failures.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The go.mod file contains a duplicate entry for the github.com/hyperledger/fabric-contract-api-go/v2 dependency. Having duplicate require entries for the same module makes the go.mod file malformed. This can lead to unpredictable behavior or outright failures when using Go toolchain commands like go build or go mod tidy, which expect a correctly structured dependency file. The change introduced a second identical line instead of modifying the existing one.

💡 Suggested Fix

Remove one of the duplicate lines for github.com/hyperledger/fabric-contract-api-go/v2 v2.2.0 from the go.mod file. Afterwards, run go mod tidy to ensure the file is correctly formatted and dependencies are consistent.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/go.mod#L9-L10

Potential issue: The `go.mod` file contains a duplicate entry for the
`github.com/hyperledger/fabric-contract-api-go/v2` dependency. Having duplicate
`require` entries for the same module makes the `go.mod` file malformed. This can lead
to unpredictable behavior or outright failures when using Go toolchain commands like `go
build` or `go mod tidy`, which expect a correctly structured dependency file. The change
introduced a second identical line instead of modifying the existing one.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7530241

github.com/hyperledger/fabric-protos-go v0.3.7
github.com/stretchr/testify v1.11.1
Expand Down
Loading