-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: add util.RunCmdWithTimeoutCheck
- Loading branch information
1 parent
bf5e0bd
commit d1eab39
Showing
8 changed files
with
100 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Check TeleYard | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.22" # 设置 Go 版本为 1.22 | ||
|
||
- name: Install dependencies | ||
run: | | ||
go mod tidy # 更新并安装所有依赖 | ||
- name: Run tests | ||
run: | | ||
go test ./... -v # 运行所有测试 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package app | ||
|
||
// 本模块为一个 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
type ModJobGetAllUserStorageLinkServerStruct struct{} | ||
|
||
var ModJobGetAllUserStorageLinkServer ModJobGetAllUserStorageLinkServerStruct | ||
|
||
func (m ModJobGetAllUserStorageLinkServerStruct) JobCmdName() string { | ||
return "get-all-user-storage-server" | ||
} | ||
|
||
func (m ModJobGetAllUserStorageLinkServerStruct) handleGetPath(c *gin.Context) { | ||
userName := c.DefaultQuery("username", "") | ||
if userName == "" { | ||
c.JSON(400, gin.H{ | ||
"error": "username is required", | ||
}) | ||
return | ||
} | ||
|
||
// 处理 | ||
|
||
// 未完成 | ||
c.JSON(200, GetAllUserStorageLinkResponse{ | ||
RemoteLinks: []string{"path1", "path2", "path3"}, | ||
}) | ||
} | ||
|
||
func (m ModJobGetAllUserStorageLinkServerStruct) listenRequest(port int) { | ||
r := gin.Default() | ||
r.GET("/getalluserstoragelink", m.handleGetPath) | ||
r.Run(fmt.Sprintf(":%d", port)) | ||
} | ||
|
||
func (m ModJobGetAllUserStorageLinkServerStruct) Run() { | ||
go m.listenRequest(8083) | ||
} | ||
|
||
func (m ModJobGetAllUserStorageLinkServerStruct) ParseJob(getAllUserStorageLinkServerCmd *cobra.Command) *cobra.Command { | ||
getAllUserStorageLinkServerCmd.Run = func(_ *cobra.Command, _ []string) { | ||
m.Run() | ||
} | ||
|
||
return getAllUserStorageLinkServerCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package storage_interface | ||
|
||
type UserStorageInfoGetter interface { | ||
} |