升級 CLI 中的 Chaincode 專案
區塊鏈 App 產生器更新後,您可以使用升級命令將現有的鏈碼專案升級為使用新功能。此命令適用於 TypeScript 和 Go 專案。
對於 Go 專案,請先升級至支援的 Go 版本,再執行升級鏈碼專案的指令。區塊鏈 App 產生器支援 Go v1.23.2 或更新版本,但不支援 Go v1.24 或更新版本。
用法:
upgrade [options]
ochain upgrade -h
Usage: upgrade [options]
Upgrade App Builder chaincode project
Options :
-h, --help output command usage information
-D, --debug enable debug logging
-p, --project <path> (optional) Path to Chaincode project to upgrade. If not specified, it defaults to current directory.
-cc, --chaincode (optional) To upgrade chaincode project
Examples :
$> ochain upgrade --project <path of chaincode dir>
若要升級鏈碼專案,請瀏覽至包含該專案的目錄,然後輸入下列命令:
ochain upgrade
如果您在升級鏈碼專案時發生問題,可以使用 --debug
選項來產生除錯日誌。在 Microsoft Windows 上,如果您指定 --debug
選項,請使用命令提示字元而不是 PowerShell。
升級鏈碼專案之後,請將規格檔案與產生的原始程式碼同步。如需詳細資訊,請參閱同步化規格檔案變更與產生的來源代碼。