首頁 > 後端開發 > Golang > 主體

Go Buffalo 測試出現 sqlite 錯誤:找不到名為 test 的連接

王林
發布: 2024-02-13 12:15:07
轉載
534 人瀏覽過

Go Buffalo 测试出现 sqlite 错误:找不到名为 test 的连接

php小編新一發現,使用Go Buffalo進行測試時,可能會遇到sqlite錯誤,提示找不到名為test的連線。這個錯誤可能會影響測試的正常進行,需要我們找到解決方案。以下將介紹一些可能導致這個錯誤的原因,並提供解決方法,以幫助開發者順利解決問題。

問題內容

我使用此指令建立的新專案出現 buffalo 測試錯誤。

buffalo new coke --db-type sqlite3
buffalo test
登入後複製

這是錯誤:

[POP] 2023/02/23 13:43:02 warn - unable to load connection development: could not create new connection: sqlite3 support was not compiled into the binary
[POP] 2023/02/23 13:43:02 warn - unable to load connection test: could not create new connection: sqlite3 support was not compiled into the binary
[POP] 2023/02/23 13:43:02 warn - unable to load connection production: could not create new connection: sqlite3 support was not compiled into the binary
Usage:
  buffalo test [flags]

Flags:
  -h, --help   help for test

ERRO[0000] Error: could not find connection named test  
登入後複製

在這個專案上執行測試之前我錯過了什麼嗎?有人請告訴我。謝謝

解決方法

輸出的第二行,

[pop] 2023/02/23 13:43:02 warn - <...>: sqlite3 support was not compiled into the binary
登入後複製

正如您在這裡所看到的,根本原因是您的 buffalo 二進位檔案未編譯為支援 sqlite3。你是怎麼安裝的?如果您使用 go install,則應該使用 -tags sqlite 選項,因此命令應為

go install -tags sqlite github.com/gobuffalo/cli/cmd/buffalo@latest
登入後複製

請參閱文件以了解更多安裝選項。

https://gobuffalo.io/documentation/ get_started/installation/#custom-installation-with-sqlite3-support

以上是Go Buffalo 測試出現 sqlite 錯誤:找不到名為 test 的連接的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:stackoverflow.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!