Go Buffalo测试与SQLite错误:无法找到名为test的连接。

huangapple go评论65阅读模式
英文:

Go Buffalo test with sqlite error: could not find connection named test

问题

这是我翻译好的内容:

在我使用以下命令创建的新项目上进行Buffalo测试时出现错误。

buffalo new coke --db-type sqlite3
buffalo test

以下是错误信息:

[POP] 2023/02/23 13:43:02 警告 - 无法加载开发环境的连接:无法创建新连接:二进制文件中未编译sqlite3支持
[POP] 2023/02/23 13:43:02 警告 - 无法加载测试环境的连接:无法创建新连接:二进制文件中未编译sqlite3支持
[POP] 2023/02/23 13:43:02 警告 - 无法加载生产环境的连接:无法创建新连接:二进制文件中未编译sqlite3支持
用法:
  buffalo test [flags]

标志:
  -h, --help   显示测试的帮助信息

ERRO[0000] 错误:找不到名为test的连接

在运行此项目的测试之前,是否有什么我忽略的步骤?请有经验的人告诉我。谢谢。

英文:

Buffalo test error on a new project I created with this command.

buffalo new coke --db-type sqlite3
buffalo test

Here is the error:

[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  

Was there something I miss before running the test on this project? Somebody please let me know. Thank you

答案1

得分: 0

你的输出的第二行是这样的:

[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/getting_started/installation/#custom-installation-with-sqlite3-support

英文:

The 2nd line of your output,

[POP] 2023/02/23 13:43:02 warn - <...>: sqlite3 support was not compiled into the binary

As you can see here, the root cause is that your buffalo binary was not compiled to support SQLite3. How did you install it? If you used go install, you should use -tags sqlite option so the command like should be

go install -tags sqlite github.com/gobuffalo/cli/cmd/buffalo@latest

See the document for more installation options.

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

huangapple
  • 本文由 发表于 2023年2月23日 14:55:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/75541486.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定