Skip to content

Commit 00ef2f5

Browse files
authored
Refactor/cost speed (#23)
* docs(di): Improve documentation with examples * docs(di): Update function comments for clarity * refactor(util): simplify cycle detection logic * fix: barry quick fix, 2025-04-10 22:09:25 * fix: barry quick fix, 2025-04-10 22:20:12 * refactor: rename dix_internal to dixinternal * fix: barry quick fix, 2025-06-05 15:12:00 * fix: barry quick fix, 2025-06-05 15:12:14 * fix: barry quick fix, 2025-06-06 20:41:18 * fix: barry quick fix, 2025-06-06 20:44:07 * fix: barry quick fix, 2025-06-06 20:50:21 * fix: barry quick fix, 2025-06-08 22:19:40 * fix: barry quick fix, 2025-06-08 22:21:00 * fix: barry quick fix, 2025-06-09 13:28:10 * fix: barry quick fix, 2025-06-09 13:28:21 * fix: barry quick fix, 2025-06-09 13:29:34 * fix: barry quick fix, 2025-06-09 13:33:03 * fix: barry quick fix, 2025-06-17 13:40:16 * fix: barry quick fix, 2025-06-22 12:59:02 * fix: barry quick fix, 2025-06-22 13:08:57 * fix: barry quick fix, 2025-06-22 20:43:34 * fix: barry quick fix, 2025-06-22 20:54:08 * fix: barry quick fix, 2025-06-22 20:57:50 * fix: barry quick fix, 2025-06-22 20:59:17 * fix: barry quick fix, 2025-06-22 21:04:58 * fix: barry quick fix, 2025-06-23 10:16:21 * fix: enhance type handling and graph rendering in Dix * chore: add golangci-lint configuration file * chore: update golangci-lint configuration and GitHub Actions for improved linting * chore: update Makefile to include linting as a phony target * refactor: update example usage in global.go to use dixglobal methods * refactor: replace Check method with Validate for improved error handling in options * fix: barry quick fix, 2025-06-26 18:52:48 * fix: barry quick fix, 2025-06-26 18:53:36 * fix: barry quick fix, 2025-06-26 19:48:07 * fix: barry quick fix, 2025-06-27 18:59:59 * refactor(dixinternal): 重构错误处理和依赖注入逻辑 - 优化错误处理,使用 result.Result 类型统一处理错误 -重构依赖注入逻辑,提高代码的可读性和可维护性 - 更新 go.mod 和 go.sum 文件,升级 funk 依赖到 v0.5.66-alpha.2版本 * refactor(dix): replace errors.NewErr with errors.WrapErr - Update error handling in dixinternal/dix.go to use errors.WrapErr instead of errors.NewErr - Upgrade github.com/pubgo/funk dependency to v0.5.66-alpha.3 in go.mod files * refactor(dixinternal): improve error handling in inject function - Rename error variable to 'r' for consistency- Use CatchErr() method to handle errors from injectFunc calls - Refactor error creation using WrapErr() for better error context - Remove commented-out debug code * refactor(dix): improve error handling and logging * fix: barry quick fix, 2025-06-28 22:20:20
1 parent 98ac5ce commit 00ef2f5

File tree

38 files changed

+2439
-921
lines changed

38 files changed

+2439
-921
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v3
15-
- uses: actions/setup-go@v3
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
1616
with:
17-
go-version: 1.19.0
17+
go-version: ">=1.22.0"
1818

1919
- name: golangci-lint
20-
uses: golangci/golangci-lint-action@v2
20+
uses: golangci/golangci-lint-action@v8
2121
with:
2222
skip-go-installation: true
2323
args: --timeout 3m --verbose

.golangci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: "2"
2+
linters:
3+
default: none
4+
enable:
5+
- govet
6+
exclusions:
7+
presets:
8+
- comments
9+
- common-false-positives
10+
- legacy
11+
- std-error-handling
12+
paths:
13+
- internal/example
14+
- cmds
15+
- vendor
16+
- third_party$
17+
- builtin$
18+
- examples$
19+
formatters:
20+
enable:
21+
- goimports
22+
- gofmt
23+
exclusions:
24+
paths:
25+
- internal/example
26+
- cmds
27+
- vendor
28+
- third_party$
29+
- builtin$
30+
- examples$

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
.PHONY: test
1+
.PHONY: test, lint
22
test:
33
@go test -race -v ./... -cover
4+
5+
lint:
6+
golangci-lint run --timeout=10m --verbose

di/di.go

Lines changed: 0 additions & 25 deletions
This file was deleted.

dix.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ package dix
33
import (
44
"reflect"
55

6-
"github.com/pubgo/dix/dix_internal"
6+
"github.com/pubgo/dix/dixinternal"
77
)
88

99
const (
10-
InjectMethodPrefix = dix_internal.InjectMethodPrefix
10+
InjectMethodPrefix = dixinternal.InjectMethodPrefix
1111
)
1212

1313
type (
14-
Option = dix_internal.Option
15-
Options = dix_internal.Options
16-
Dix = dix_internal.Dix
17-
Graph = dix_internal.Graph
14+
Option = dixinternal.Option
15+
Options = dixinternal.Options
16+
Dix = dixinternal.Dix
17+
Graph = dixinternal.Graph
1818
)
1919

2020
func WithValuesNull() Option {
21-
return dix_internal.WithValuesNull()
21+
return dixinternal.WithValuesNull()
2222
}
2323

2424
func New(opts ...Option) *Dix {
25-
return dix_internal.New(opts...)
25+
return dixinternal.New(opts...)
2626
}
2727

2828
func Inject[T any](di *Dix, data T, opts ...Option) T {

dix_internal/api.go

Lines changed: 0 additions & 21 deletions
This file was deleted.

dix_internal/cycle-check.go

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)