Skip to content

Commit f1ae9f0

Browse files
authored
feat: init go project (#1064)
1 parent 605284a commit f1ae9f0

File tree

5 files changed

+89
-0
lines changed

5 files changed

+89
-0
lines changed

.github/workflows/test-core.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Check swanlab-core
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- core/**
7+
8+
9+
jobs:
10+
check-and-test:
11+
strategy:
12+
matrix:
13+
go: [stable, '1.24.4']
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
name: Check and Test Go Core on ${{ matrix.os }} with Go ${{ matrix.go }}
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Go environment
23+
uses: actions/[email protected]
24+
with:
25+
go-version: ${{ matrix.go }}
26+
cache: 'true'
27+
28+
- name: Golangci-lint
29+
uses: golangci/[email protected]
30+
with:
31+
working-directory: 'core'
32+

core/LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../LICENSE

core/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<div align="center">
2+
<picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="../readme_files/swanlab-logo-single-dark.svg">
4+
<source media="(prefers-color-scheme: light)" srcset="../readme_files/swanlab-logo-single.svg">
5+
<img alt="SwanLab" src="../readme_files/swanlab-logo-single.svg" width="70" height="70">
6+
</picture>
7+
</div>
8+
9+
# swanlab-core: A new backend for SwanLab SDK
10+
11+
To address the challenges posed by Python's asynchronous programming, we introduced swanlab-core, a brand-new, Go-based backend for metric uploading.
12+
13+
14+
## IDE & Development Setup
15+
16+
In this part, we will guide you through the process of setting up your IDE and development environment for SwanLab SDK.
17+
We will use:
18+
1. [GoLand](https://www.jetbrains.com/go/) as the IDE.
19+
2. [Go](https://go.dev/) as the programming language.
20+
3. [golangci-lint](https://golangci-lint.run/) as the linter.
21+
22+
## IDE
23+
24+
We request using GoLand as the IDE for swanlab-core development.
25+
It provides a rich set of features for Go development, including code completion, debugging, and integration with version control systems.
26+
27+
There is the code template for Go file in GoLand:
28+
29+
```text
30+
package ${GO_PACKAGE_NAME}
31+
32+
// @Title ${FILE_NAME}
33+
// @Description
34+
// @Create cunyue ${DATE} ${TIME}
35+
```
36+
37+
## Linter
38+
39+
We use [golangci-lint](https://golangci-lint.run/) as the linter for swanlab-core development.
40+
Since SwanLab is a Python project, some developers may not be very familiar with the Go language.
41+
Therefore, golangci-lint is not mandatory and will only trigger this CI when changes are made to the core part.
42+
43+
If you plan to develop swanlab-core, configure the golangci-lint integration in GoLand, which can be found under Go -> Linter settings.
44+
45+
## Env
46+
47+
TODO
48+

core/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/SwanHubX/SwanLab/core
2+
3+
go 1.24.4

core/internal/api/api.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package api
2+
3+
// @Title api.go
4+
// @Description SwanLab API intended for requests to the SwanLab-Server.
5+
// @Create cunyue 2025/6/10 13:00

0 commit comments

Comments
 (0)