From fb5a725a2443723d57c3bf5c74d3ef1f00935cf0 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 2 Oct 2026 09:47:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?docs=F0=9F=93=9D:=20fix=20the=20init=20comm?= =?UTF-8?q?and's=20config=20name=20and=20add=20a=20SQLite=20quick=20start?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The README told readers to run `migrate -c config/settings.dev.yml`, a file that does not exist; the command stops with "no such file or directory". Point it at config/settings.yml, in all four READMEs. The default config needs a MySQL server, so there was no way to see the project running without installing one first. Add a short SQLite quick start at the top of the startup section: three commands, the build tag a plain `go build` leaves out, and the default account. --- README.Zh-cn.md | 19 +++++++++++++++++-- README.ja-JP.md | 19 +++++++++++++++++-- README.md | 19 +++++++++++++++++-- README.zh-TW.md | 19 +++++++++++++++++-- 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/README.Zh-cn.md b/README.Zh-cn.md index ede3ce97..6eb67e21 100644 --- a/README.Zh-cn.md +++ b/README.Zh-cn.md @@ -136,6 +136,21 @@ git clone https://github.com/go-admin-team/go-admin-ui.git ### 启动说明 +#### SQLite 快速体验(无需安装数据库) + +这是看到 go-admin 跑起来的最短路径。需要 C 编译器(cgo),并且要带 `sqlite3` 构建标签,普通的 `go build` 不包含它。 + +```bash +cd ./go-admin +go build -tags sqlite3 -o go-admin . +./go-admin migrate -c config/settings.sqlite.yml +./go-admin server -c config/settings.sqlite.yml +``` + +Windows 下把 `./go-admin` 换成 `go-admin.exe`。启动后接口地址是 `http://localhost:8000`。要打开界面,在 `go-admin-ui` 里执行 `pnpm install` 和 `pnpm dev`,然后用 `admin` / `123456` 登录。 + +使用 MySQL、PostgreSQL 或 SQL Server 时,请按下面的步骤操作。 + #### 服务端启动说明 ```bash @@ -181,10 +196,10 @@ cgo: exec gcc: exec: "gcc": executable file not found in %PATH% ``` bash # 首次配置需要初始化数据库资源信息 # macOS or linux 下使用 -$ ./go-admin migrate -c config/settings.dev.yml +$ ./go-admin migrate -c config/settings.yml # ⚠️注意:windows 下使用 -$ go-admin.exe migrate -c config/settings.dev.yml +$ go-admin.exe migrate -c config/settings.yml # 启动项目,也可以用IDE进行调试 diff --git a/README.ja-JP.md b/README.ja-JP.md index f02eba09..7393f604 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -136,6 +136,21 @@ git clone https://github.com/go-admin-team/go-admin-ui.git ### 起動方法 +#### SQLite でとりあえず動かす(データベースのインストール不要) + +go-admin が動くところまでの最短手順です。C コンパイラ(cgo)と `sqlite3` ビルドタグが必要で、通常の `go build` にはタグが含まれません。 + +```bash +cd ./go-admin +go build -tags sqlite3 -o go-admin . +./go-admin migrate -c config/settings.sqlite.yml +./go-admin server -c config/settings.sqlite.yml +``` + +Windows では `./go-admin` を `go-admin.exe` に置き換えてください。起動後の API は `http://localhost:8000` です。画面を開くには `go-admin-ui` で `pnpm install` と `pnpm dev` を実行し、`admin` / `123456` でログインします。 + +MySQL、PostgreSQL、SQL Server を使う場合は、以下の手順に従ってください。 + #### サーバーの起動 ```bash @@ -181,10 +196,10 @@ cgo: exec gcc: exec: "gcc": executable file not found in %PATH% ``` bash # 初回はデータベースのリソース情報を初期化する必要があります # macOS または linux の場合 -$ ./go-admin migrate -c config/settings.dev.yml +$ ./go-admin migrate -c config/settings.yml # ⚠️注意: windows の場合 -$ go-admin.exe migrate -c config/settings.dev.yml +$ go-admin.exe migrate -c config/settings.yml # プロジェクトを起動します。IDE からデバッグ実行することもできます diff --git a/README.md b/README.md index 87faae68..ec90feae 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,21 @@ git clone https://github.com/go-admin-team/go-admin-ui.git ### Startup instructions +#### Quick start with SQLite (nothing to install) + +This is the shortest way to see go-admin running. It needs a C compiler (cgo) and the `sqlite3` build tag, which a plain `go build` does not include. + +```bash +cd ./go-admin +go build -tags sqlite3 -o go-admin . +./go-admin migrate -c config/settings.sqlite.yml +./go-admin server -c config/settings.sqlite.yml +``` + +On Windows, use `go-admin.exe` instead of `./go-admin`. The API is then at `http://localhost:8000`. To open the UI, run `pnpm install` and `pnpm dev` in `go-admin-ui`, then sign in with `admin` / `123456`. + +For MySQL, PostgreSQL or SQL Server, follow the steps below instead. + #### Server startup instructions ```bash @@ -178,10 +193,10 @@ cgo: exec gcc: exec: "gcc": executable file not found in %PATH% ``` bash # The first configuration needs to initialize the database resource information # Use under macOS or linux -$ ./go-admin migrate -c config/settings.dev.yml +$ ./go-admin migrate -c config/settings.yml # ⚠️Note: Use under windows -$ go-admin.exe migrate -c config/settings.dev.yml +$ go-admin.exe migrate -c config/settings.yml # Start the project, you can also use the IDE for debugging # Use under macOS or linux diff --git a/README.zh-TW.md b/README.zh-TW.md index e6971264..080213c0 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -136,6 +136,21 @@ git clone https://github.com/go-admin-team/go-admin-ui.git ### 啟動說明 +#### SQLite 快速體驗(無需安裝資料庫) + +這是看到 go-admin 跑起來的最短路徑。需要 C 編譯器(cgo),並且要帶 `sqlite3` 建置標籤,一般的 `go build` 不包含它。 + +```bash +cd ./go-admin +go build -tags sqlite3 -o go-admin . +./go-admin migrate -c config/settings.sqlite.yml +./go-admin server -c config/settings.sqlite.yml +``` + +Windows 下把 `./go-admin` 換成 `go-admin.exe`。啟動後 API 位址是 `http://localhost:8000`。要開啟介面,在 `go-admin-ui` 中執行 `pnpm install` 與 `pnpm dev`,然後用 `admin` / `123456` 登入。 + +使用 MySQL、PostgreSQL 或 SQL Server 時,請依下面的步驟操作。 + #### 伺服器端啟動說明 ```bash @@ -181,10 +196,10 @@ cgo: exec gcc: exec: "gcc": executable file not found in %PATH% ``` bash # 首次設定需要初始化資料庫資源資訊 # macOS or linux 下使用 -$ ./go-admin migrate -c config/settings.dev.yml +$ ./go-admin migrate -c config/settings.yml # ⚠️注意:windows 下使用 -$ go-admin.exe migrate -c config/settings.dev.yml +$ go-admin.exe migrate -c config/settings.yml # 啟動專案,也可以用 IDE 進行除錯 From 2ec6cbdde89e90b9b5536f091cbb3756f24a2bec Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 2 Oct 2026 09:47:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=F0=9F=90=9B:=20tell=20a=20default=20bui?= =?UTF-8?q?ld=20how=20to=20get=20the=20sqlite3=20driver?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A default build does not include sqlite3, and a config that names it stopped with "unsupported database driver "sqlite3", this build supports mysql, postgres, sqlserver". That says what is missing but not what to do about it. For sqlite3 specifically, say to rebuild with -tags sqlite3. The test runs only in a build without the tag, and fails without the hint. --- common/database/driver.go | 6 ++++++ common/database/driver_nosqlite_test.go | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 common/database/driver_nosqlite_test.go diff --git a/common/database/driver.go b/common/database/driver.go index eac8340c..e8184f59 100644 --- a/common/database/driver.go +++ b/common/database/driver.go @@ -17,6 +17,12 @@ import ( func openerFor(driver string) (func(string) gorm.Dialector, error) { open, ok := opens[driver] if !ok { + // sqlite3 is the driver people reach for first, and the one a default + // build leaves out. Say how to get it rather than only what is missing. + if driver == "sqlite3" { + return nil, fmt.Errorf("database driver %q is not in this build, rebuild with -tags sqlite3 (this build supports %s)", + driver, strings.Join(supportedDrivers(), ", ")) + } return nil, fmt.Errorf("unsupported database driver %q, this build supports %s", driver, strings.Join(supportedDrivers(), ", ")) } diff --git a/common/database/driver_nosqlite_test.go b/common/database/driver_nosqlite_test.go new file mode 100644 index 00000000..2d14d52f --- /dev/null +++ b/common/database/driver_nosqlite_test.go @@ -0,0 +1,20 @@ +//go:build !sqlite3 + +package database + +import ( + "strings" + "testing" +) + +// A default build has no sqlite3, and a config naming it is the usual first +// run. The error has to say how to get the driver, not only that it is missing. +func TestOpenerForTellsHowToGetSqliteInADefaultBuild(t *testing.T) { + _, err := openerFor("sqlite3") + if err == nil { + t.Fatal("sqlite3 was accepted by a build without the sqlite3 tag") + } + if !strings.Contains(err.Error(), "-tags sqlite3") { + t.Errorf("error does not say how to enable sqlite3: %s", err) + } +} From 458c94e77e2ed7ee055ad877de81525af678e9dc Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 2 Oct 2026 19:18:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?docs=F0=9F=93=9D:=20let=20go=20build=20name?= =?UTF-8?q?=20the=20executable=20in=20the=20SQLite=20quick=20start?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An explicit -o go-admin writes a file named go-admin on Windows too, so the go-admin.exe commands that follow could not find it. Without -o, go build names the binary after the module and adds the platform's suffix. --- README.Zh-cn.md | 2 +- README.ja-JP.md | 2 +- README.md | 2 +- README.zh-TW.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.Zh-cn.md b/README.Zh-cn.md index 6eb67e21..7578e8b1 100644 --- a/README.Zh-cn.md +++ b/README.Zh-cn.md @@ -142,7 +142,7 @@ git clone https://github.com/go-admin-team/go-admin-ui.git ```bash cd ./go-admin -go build -tags sqlite3 -o go-admin . +go build -tags sqlite3 ./go-admin migrate -c config/settings.sqlite.yml ./go-admin server -c config/settings.sqlite.yml ``` diff --git a/README.ja-JP.md b/README.ja-JP.md index 7393f604..4d7c0237 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -142,7 +142,7 @@ go-admin が動くところまでの最短手順です。C コンパイラ(cgo ```bash cd ./go-admin -go build -tags sqlite3 -o go-admin . +go build -tags sqlite3 ./go-admin migrate -c config/settings.sqlite.yml ./go-admin server -c config/settings.sqlite.yml ``` diff --git a/README.md b/README.md index ec90feae..e6a07cd5 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ This is the shortest way to see go-admin running. It needs a C compiler (cgo) an ```bash cd ./go-admin -go build -tags sqlite3 -o go-admin . +go build -tags sqlite3 ./go-admin migrate -c config/settings.sqlite.yml ./go-admin server -c config/settings.sqlite.yml ``` diff --git a/README.zh-TW.md b/README.zh-TW.md index 080213c0..7db9f1de 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -142,7 +142,7 @@ git clone https://github.com/go-admin-team/go-admin-ui.git ```bash cd ./go-admin -go build -tags sqlite3 -o go-admin . +go build -tags sqlite3 ./go-admin migrate -c config/settings.sqlite.yml ./go-admin server -c config/settings.sqlite.yml ```