Home > Backend Development > Golang > Go Buffalo test sqlite error: Connection named test not found

Go Buffalo test sqlite error: Connection named test not found

王林
Release: 2024-02-13 12:15:07
forward
578 people have browsed it

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

php editor Xinyi discovered that when using Go Buffalo for testing, you may encounter a sqlite error, prompting that the connection named test cannot be found. This error may affect the normal progress of the test and we need to find a solution. The following will introduce some possible causes of this error and provide solutions to help developers solve the problem smoothly.

Question content

I am getting buffalo test errors on new projects I created using this command.

buffalo new coke --db-type sqlite3
buffalo test
Copy after login

This is an 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  
Copy after login

Did I miss anything before running tests on this project? Someone please tell me. Thank you

Solution

The second line of output,

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

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 use go install, you should use the -tags sqlite option, so the command should be

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

See the documentation for more installation options.

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

The above is the detailed content of Go Buffalo test sqlite error: Connection named test not found. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template