diff --git a/Makefile b/Makefile index e4117f15..9f2c5a85 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,8 @@ init: install-tools: @go install golang.org/x/tools/cmd/godoc@latest + @go install golang.org/x/tools/cmd/goimports@latest + @go install honnef.co/go/tools/cmd/staticcheck@latest install-modules: @for dir in $(MODULE_DIRS); do \ @@ -57,7 +59,7 @@ clean-cache: sync: @go work sync -check: lint test +check: lint test staticcheck test: @for dir in $(MODULE_DIRS); do \ @@ -75,11 +77,11 @@ benchmark: cd $$dir && go test -run="-" -bench=".*" -benchmem $(test-options) ./...; \ done -lint: fmt vet +lint: fmt vet staticcheck fmt: @for dir in $(MODULE_DIRS); do \ - cd $$dir && go fmt ./...; \ + cd $$dir && goimports -w .; \ done vet: @@ -87,6 +89,11 @@ vet: cd $$dir && go vet ./...; \ done +staticcheck: + @for dir in $(MODULE_DIRS); do \ + cd $$dir && staticcheck ./...; \ + done + doc: init @godoc -http=:6060 diff --git a/README.md b/README.md index ba02ef29..e5550dda 100644 --- a/README.md +++ b/README.md @@ -85,12 +85,12 @@ pong# Adjust settings through `.uniflow.toml` or environment variables. -| TOML Key | Environment Variable Key | Example | -|----------------------|--------------------------|---------------------------| -| `database.url` | `DATABASE.URL` | `mem://` or `mongodb://` | -| `database.name` | `DATABASE.NAME` | - | -| `collection.specs` | `COLLECTION.SPECS` | `nodes` | -| `collection.secrets` | `COLLECTION.SECRETS` | `secrets` | +| TOML Key | Environment Variable Key | Example | +|----------------------|--------------------------|--------------------------| +| `database.url` | `DATABASE_URL` | `mem://` or `mongodb://` | +| `database.name` | `DATABASE_NAME` | - | +| `collection.specs` | `COLLECTION_SPECS` | `nodes` | +| `collection.secrets` | `COLLECTION_SECRETS` | `secrets` | ## πŸ“Š Benchmark diff --git a/README_kr.md b/README_kr.md index 3397d986..922c6fd1 100644 --- a/README_kr.md +++ b/README_kr.md @@ -85,12 +85,12 @@ pong# ν™˜κ²½ 섀정은 `.uniflow.toml` 파일 λ˜λŠ” μ‹œμŠ€ν…œ ν™˜κ²½ λ³€μˆ˜λ₯Ό 톡해 관리할 수 μžˆμŠ΅λ‹ˆλ‹€. -| TOML ν‚€ | ν™˜κ²½ λ³€μˆ˜ ν‚€ | μ˜ˆμ‹œ | -|----------------------|--------------------------|---------------------------| -| `database.url` | `DATABASE.URL` | `mem://` λ˜λŠ” `mongodb://` | -| `database.name` | `DATABASE.NAME` | - | -| `collection.specs` | `COLLECTION.SPECS` | `nodes` | -| `collection.secrets` | `COLLECTION.SECRETS` | `secrets` | +| TOML ν‚€ | ν™˜κ²½ λ³€μˆ˜ ν‚€ | μ˜ˆμ‹œ | +|----------------------|----------------------|--------------------------| +| `database.url` | `DATABASE_URL` | `mem://` λ˜λŠ” `mongodb://` | +| `database.name` | `DATABASE_NAME` | - | +| `collection.specs` | `COLLECTION_SPECS` | `nodes` | +| `collection.secrets` | `COLLECTION_SECRETS` | `secrets` | ## πŸ“Š 벀치마크 diff --git a/cmd/README.md b/cmd/README.md index 5efd636d..6deca04c 100644 --- a/cmd/README.md +++ b/cmd/README.md @@ -6,13 +6,13 @@ Effectively manage your workflows using the versatile Command Line Interface (CL Settings can be modified using the `.uniflow.toml` file or system environment variables. The key configuration options are: -| TOML Key | Environment Variable Key | Example | -|----------------------|--------------------------|-----------------------------| -| `database.url` | `DATABASE.URL` | `mem://` or `mongodb://` | -| `database.name` | `DATABASE.NAME` | - | -| `collection.charts` | `COLLECTION.CHARTS` | `charts` | -| `collection.specs` | `COLLECTION.SPECS` | `nodes` | -| `collection.secrets` | `COLLECTION.SECRETS` | `secrets` | +| TOML Key | Environment Variable Key | Example | +|----------------------|--------------------------|--------------------------| +| `database.url` | `DATABASE_URL` | `mem://` or `mongodb://` | +| `database.name` | `DATABASE_NAME` | - | +| `collection.charts` | `COLLECTION_CHARTS` | `charts` | +| `collection.specs` | `COLLECTION_SPECS` | `nodes` | +| `collection.secrets` | `COLLECTION_SECRETS` | `secrets` | If you are using [MongoDB](https://www.mongodb.com/), enable [Change Streams](https://www.mongodb.com/docs/manual/changeStreams/) to track resource changes in real time. This requires setting up a [replica set](https://www.mongodb.com/docs/manual/replication/). diff --git a/cmd/README_kr.md b/cmd/README_kr.md index 62d5dcf4..02a67114 100644 --- a/cmd/README_kr.md +++ b/cmd/README_kr.md @@ -6,13 +6,13 @@ 섀정은 `.uniflow.toml` νŒŒμΌμ΄λ‚˜ μ‹œμŠ€ν…œ ν™˜κ²½ λ³€μˆ˜λ₯Ό μ‚¬μš©ν•΄ μœ μ—°ν•˜κ²Œ λ³€κ²½ν•  수 μžˆμŠ΅λ‹ˆλ‹€. μ£Όμš” μ„€μ • ν•­λͺ©μ€ λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€: -| TOML ν‚€ | ν™˜κ²½ λ³€μˆ˜ ν‚€ | μ˜ˆμ‹œ | -|----------------------|-------------------------|----------------------------| -| `database.url` | `DATABASE.URL` | `mem://` λ˜λŠ” `mongodb://` | -| `database.name` | `DATABASE.NAME` | - | -| `collection.charts` | `COLLECTION.CHARTS` | `charts` | -| `collection.specs` | `COLLECTION.SPECS` | `nodes` | -| `collection.secrets` | `COLLECTION.SECRETS` | `secrets` | +| TOML ν‚€ | ν™˜κ²½ λ³€μˆ˜ ν‚€ | μ˜ˆμ‹œ | +|----------------------|----------------------|--------------------------| +| `database.url` | `DATABASE_URL` | `mem://` λ˜λŠ” `mongodb://` | +| `database.name` | `DATABASE_NAME` | - | +| `collection.charts` | `COLLECTION_CHARTS` | `charts` | +| `collection.specs` | `COLLECTION_SPECS` | `nodes` | +| `collection.secrets` | `COLLECTION_SECRETS` | `secrets` | λ§Œμ•½ [MongoDB](https://www.mongodb.com/)λ₯Ό μ‚¬μš©ν•œλ‹€λ©΄, λ¦¬μ†ŒμŠ€μ˜ λ³€κ²½ 사항을 μ‹€μ‹œκ°„μœΌλ‘œ μΆ”μ ν•˜κΈ° μœ„ν•΄ [λ³€κ²½ 슀트림](https://www.mongodb.com/docs/manual/changeStreams/)을 ν™œμ„±ν™”ν•΄μ•Ό ν•©λ‹ˆλ‹€. 이λ₯Ό μœ„ν•΄μ„œλŠ” [볡제 μ„ΈνŠΈ](https://www.mongodb.com/docs/manual/replication/) 섀정이 ν•„μš”ν•©λ‹ˆλ‹€. diff --git a/cmd/go.mod b/cmd/go.mod index b9c7cbf9..2b1fbc20 100644 --- a/cmd/go.mod +++ b/cmd/go.mod @@ -7,14 +7,18 @@ require ( github.com/charmbracelet/bubbletea v1.2.4 github.com/go-faker/faker/v4 v4.5.0 github.com/gofrs/uuid v4.4.0+incompatible + github.com/iancoleman/strcase v0.3.0 github.com/jedib0t/go-pretty/v6 v6.6.5 + github.com/knadh/koanf/parsers/toml v0.1.0 + github.com/knadh/koanf/providers/env v1.0.0 + github.com/knadh/koanf/providers/file v1.1.2 + github.com/knadh/koanf/v2 v2.1.2 github.com/mattn/go-sqlite3 v1.14.24 github.com/siyul-park/uniflow v0.12.0 github.com/siyul-park/uniflow/driver/mongo v0.12.1 github.com/siyul-park/uniflow/ext v0.12.0 github.com/spf13/afero v1.11.0 github.com/spf13/cobra v1.8.1 - github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 github.com/tryvium-travels/memongo v0.12.0 go.mongodb.org/mongo-driver/v2 v2.0.0 @@ -44,43 +48,37 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.23.0 // indirect github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/cel-go v0.22.1 // indirect github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect github.com/gorilla/websocket v1.5.3 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmoiron/sqlx v1.4.0 // indirect github.com/klauspost/compress v1.17.11 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/magiconair/properties v1.8.9 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/montanaflynn/stats v0.7.1 // indirect github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/termenv v0.15.2 // indirect - github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/sagikazarmark/locafero v0.6.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/cast v1.7.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect - github.com/subosito/gotenv v1.6.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect go.mongodb.org/mongo-driver v1.17.1 // indirect - go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect golang.org/x/net v0.33.0 // indirect @@ -90,5 +88,4 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect google.golang.org/protobuf v1.36.1 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect ) diff --git a/cmd/go.sum b/cmd/go.sum index 401d16c0..c213044a 100644 --- a/cmd/go.sum +++ b/cmd/go.sum @@ -41,8 +41,6 @@ github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0 github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/evanw/esbuild v0.24.2 h1:PQExybVBrjHjN6/JJiShRGIXh1hWVm6NepVnhZhrt0A= github.com/evanw/esbuild v0.24.2/go.mod h1:D2vIQZqV/vIf/VRHtViaUtViZmG7o+kKmlBfVQuRi48= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA= @@ -61,6 +59,8 @@ github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TC github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= @@ -75,8 +75,6 @@ github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/Z github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -87,6 +85,16 @@ github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/parsers/toml v0.1.0 h1:S2hLqS4TgWZYj4/7mI5m1CQQcWurxUz6ODgOub/6LCI= +github.com/knadh/koanf/parsers/toml v0.1.0/go.mod h1:yUprhq6eo3GbyVXFFMdbfZSo928ksS+uo0FFqNMnO18= +github.com/knadh/koanf/providers/env v1.0.0 h1:ufePaI9BnWH+ajuxGGiJ8pdTG0uLEUWC7/HDDPGLah0= +github.com/knadh/koanf/providers/env v1.0.0/go.mod h1:mzFyRZueYhb37oPmC1HAv/oGEEuyvJDA98r3XAa8Gak= +github.com/knadh/koanf/providers/file v1.1.2 h1:aCC36YGOgV5lTtAFz2qkgtWdeQsgfxUkxDOe+2nQY3w= +github.com/knadh/koanf/providers/file v1.1.2/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI= +github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= +github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -97,8 +105,6 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM= -github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= @@ -108,8 +114,10 @@ github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= @@ -118,8 +126,8 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI= github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -133,10 +141,6 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk= -github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/siyul-park/uniflow v0.12.0 h1:o+SqvRAnSyiJbRq1a/ph9XXXWqjwrsQZ8zQg2obdNQc= @@ -145,18 +149,12 @@ github.com/siyul-park/uniflow/driver/mongo v0.12.1 h1:VkMk+nBnNkc6+GGAvaOPwn3Wmx github.com/siyul-park/uniflow/driver/mongo v0.12.1/go.mod h1:4KZaNR3STtbfXOgO93wca7bB/nLQMHY48OFMElO3TRI= github.com/siyul-park/uniflow/ext v0.12.0 h1:2DWX4+m/oGjpJCrYK2wh8oTsDJWPUogQquGbZpMcFCA= github.com/siyul-park/uniflow/ext v0.12.0/go.mod h1:Eus3OYQkzxeW9PkVrmvtMHhxaoD0pWzH1XSJdNYLXmE= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= -github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= -github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -167,8 +165,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tryvium-travels/memongo v0.12.0 h1:B56+Do7Z3vcR93oqkyUubvdFPJEqpHn1ZBSQRYe4Nnk= github.com/tryvium-travels/memongo v0.12.0/go.mod h1:riRUHKRQ5JbeX2ryzFfmr7P2EYXIkNwgloSQJPpBikA= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= @@ -186,8 +182,6 @@ go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHy go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= go.mongodb.org/mongo-driver/v2 v2.0.0 h1:Jfd7XpdZa9yk3eY774bO7SWVb30noLSirL9nKTpavhI= go.mongodb.org/mongo-driver/v2 v2.0.0/go.mod h1:nSjmNq4JUstE8IRZKTktLgMHM4F1fccL6HGX1yh+8RA= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= @@ -235,8 +229,6 @@ google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojt gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= -gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cmd/pkg/cli/debug.go b/cmd/pkg/cli/debug.go index 8d5c5203..642a916d 100644 --- a/cmd/pkg/cli/debug.go +++ b/cmd/pkg/cli/debug.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/siyul-park/uniflow/pkg/runtime" "slices" "strings" "time" @@ -16,6 +15,7 @@ import ( "github.com/siyul-park/uniflow/cmd/pkg/resource" "github.com/siyul-park/uniflow/pkg/port" "github.com/siyul-park/uniflow/pkg/process" + "github.com/siyul-park/uniflow/pkg/runtime" "github.com/siyul-park/uniflow/pkg/symbol" "github.com/siyul-park/uniflow/pkg/types" ) diff --git a/cmd/pkg/cli/debug_test.go b/cmd/pkg/cli/debug_test.go index 41a54862..a073f96f 100644 --- a/cmd/pkg/cli/debug_test.go +++ b/cmd/pkg/cli/debug_test.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/siyul-park/uniflow/pkg/runtime" "testing" "time" @@ -17,6 +16,7 @@ import ( "github.com/siyul-park/uniflow/pkg/port" "github.com/siyul-park/uniflow/pkg/process" "github.com/siyul-park/uniflow/pkg/resource" + "github.com/siyul-park/uniflow/pkg/runtime" "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/symbol" "github.com/siyul-park/uniflow/pkg/types" diff --git a/cmd/pkg/driver/driver.go b/cmd/pkg/driver/driver.go index 892db299..49c3a20d 100644 --- a/cmd/pkg/driver/driver.go +++ b/cmd/pkg/driver/driver.go @@ -2,6 +2,7 @@ package driver import ( "context" + "github.com/siyul-park/uniflow/pkg/chart" "github.com/siyul-park/uniflow/pkg/secret" "github.com/siyul-park/uniflow/pkg/spec" diff --git a/cmd/pkg/driver/inmemory.go b/cmd/pkg/driver/inmemory.go index f284b8f0..e33d12bd 100644 --- a/cmd/pkg/driver/inmemory.go +++ b/cmd/pkg/driver/inmemory.go @@ -2,6 +2,7 @@ package driver import ( "context" + "github.com/siyul-park/uniflow/pkg/chart" "github.com/siyul-park/uniflow/pkg/secret" "github.com/siyul-park/uniflow/pkg/spec" diff --git a/cmd/pkg/driver/inmemory_test.go b/cmd/pkg/driver/inmemory_test.go index 66341d8d..1a84eea4 100644 --- a/cmd/pkg/driver/inmemory_test.go +++ b/cmd/pkg/driver/inmemory_test.go @@ -2,9 +2,10 @@ package driver import ( "context" - "github.com/stretchr/testify/assert" "testing" "time" + + "github.com/stretchr/testify/assert" ) func TestNewInMemoryDriver(t *testing.T) { diff --git a/cmd/pkg/driver/mongo.go b/cmd/pkg/driver/mongo.go index 30d25fdf..fcc5bc1e 100644 --- a/cmd/pkg/driver/mongo.go +++ b/cmd/pkg/driver/mongo.go @@ -2,6 +2,8 @@ package driver import ( "context" + "strings" + "github.com/gofrs/uuid" mongochart "github.com/siyul-park/uniflow/driver/mongo/pkg/chart" mongosecret "github.com/siyul-park/uniflow/driver/mongo/pkg/secret" @@ -13,7 +15,6 @@ import ( "github.com/tryvium-travels/memongo" "go.mongodb.org/mongo-driver/v2/mongo" "go.mongodb.org/mongo-driver/v2/mongo/options" - "strings" ) // MongoDriver represents a MongoDB connection and provides methods to interact with the database. diff --git a/cmd/pkg/driver/mongo_test.go b/cmd/pkg/driver/mongo_test.go index 03d1a646..4897b08f 100644 --- a/cmd/pkg/driver/mongo_test.go +++ b/cmd/pkg/driver/mongo_test.go @@ -2,8 +2,9 @@ package driver import ( "context" - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestNewMongoDriver(t *testing.T) { diff --git a/cmd/pkg/uniflow/main.go b/cmd/pkg/uniflow/main.go index dd5f767b..0dc3f6ae 100644 --- a/cmd/pkg/uniflow/main.go +++ b/cmd/pkg/uniflow/main.go @@ -2,12 +2,17 @@ package main import ( "context" - "github.com/siyul-park/uniflow/cmd/pkg/driver" "log" "strings" + "github.com/iancoleman/strcase" + "github.com/knadh/koanf/parsers/toml" + "github.com/knadh/koanf/providers/env" + "github.com/knadh/koanf/providers/file" + "github.com/knadh/koanf/v2" _ "github.com/mattn/go-sqlite3" "github.com/siyul-park/uniflow/cmd/pkg/cli" + "github.com/siyul-park/uniflow/cmd/pkg/driver" "github.com/siyul-park/uniflow/ext/pkg/control" "github.com/siyul-park/uniflow/ext/pkg/io" "github.com/siyul-park/uniflow/ext/pkg/language" @@ -22,7 +27,6 @@ import ( "github.com/siyul-park/uniflow/pkg/hook" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/spf13/afero" - "github.com/spf13/viper" ) const configFile = ".uniflow.toml" @@ -48,24 +52,37 @@ const ( opDeleteCharts = "charts.delete" ) +var k = koanf.New(".") + func init() { - viper.SetDefault(cli.EnvCollectionSpecs, "specs") - viper.SetDefault(cli.EnvCollectionSecrets, "secrets") - viper.SetDefault(cli.EnvCollectionCharts, "charts") + if err := k.Set(cli.EnvCollectionSpecs, "specs"); err != nil { + log.Fatal(err) + } + if err := k.Set(cli.EnvCollectionSecrets, "secrets"); err != nil { + log.Fatal(err) + } + if err := k.Set(cli.EnvCollectionCharts, "charts"); err != nil { + log.Fatal(err) + } - viper.SetConfigFile(configFile) - viper.AutomaticEnv() - viper.ReadInConfig() + if err := k.Load(file.Provider(configFile), toml.Parser()); err != nil { + log.Fatal(err) + } + if err := k.Load(env.Provider("", ".", func(s string) string { + return strcase.ToDelimited(s, '.') + }), nil); err != nil { + log.Fatal(err) + } } func main() { ctx := context.Background() - databaseURL := viper.GetString(cli.EnvDatabaseURL) - databaseName := viper.GetString(cli.EnvDatabaseName) - collectionNodes := viper.GetString(cli.EnvCollectionSpecs) - collectionSecrets := viper.GetString(cli.EnvCollectionSecrets) - collectionCharts := viper.GetString(cli.EnvCollectionCharts) + databaseURL := k.String(cli.EnvDatabaseURL) + databaseName := k.String(cli.EnvDatabaseName) + collectionNodes := k.String(cli.EnvCollectionSpecs) + collectionSecrets := k.String(cli.EnvCollectionSecrets) + collectionCharts := k.String(cli.EnvCollectionCharts) d := driver.NewInMemoryDriver() defer d.Close(ctx) @@ -106,7 +123,7 @@ func main() { topicSecrets: system.WatchResource(secretStore), topicCharts: system.WatchResource(chartStore), } - syscalls := map[string]any{ + calls := map[string]any{ opCreateSpecs: system.CreateResource(specStore), opReadSpecs: system.ReadResource(specStore), opUpdateSpecs: system.UpdateResource(specStore), @@ -128,8 +145,8 @@ func main() { log.Fatal(err) } } - for opcode, syscall := range syscalls { - if err := systemAddToScheme.SetSyscall(opcode, syscall); err != nil { + for opcode, call := range calls { + if err := systemAddToScheme.SetCalls(opcode, call); err != nil { log.Fatal(err) } } diff --git a/cmd/pkg/uniflowctl/main.go b/cmd/pkg/uniflowctl/main.go index 2a70db9c..f7efb1b6 100644 --- a/cmd/pkg/uniflowctl/main.go +++ b/cmd/pkg/uniflowctl/main.go @@ -2,36 +2,53 @@ package main import ( "context" - "github.com/siyul-park/uniflow/cmd/pkg/driver" "log" "strings" + "github.com/iancoleman/strcase" + "github.com/knadh/koanf/parsers/toml" + "github.com/knadh/koanf/providers/env" + "github.com/knadh/koanf/providers/file" + "github.com/knadh/koanf/v2" _ "github.com/mattn/go-sqlite3" "github.com/siyul-park/uniflow/cmd/pkg/cli" + "github.com/siyul-park/uniflow/cmd/pkg/driver" "github.com/spf13/afero" - "github.com/spf13/viper" ) const configFile = ".uniflow.toml" +var k = koanf.New(".") + func init() { - viper.SetDefault(cli.EnvCollectionSpecs, "specs") - viper.SetDefault(cli.EnvCollectionSecrets, "secrets") - viper.SetDefault(cli.EnvCollectionCharts, "charts") + if err := k.Set(cli.EnvCollectionSpecs, "specs"); err != nil { + log.Fatal(err) + } + if err := k.Set(cli.EnvCollectionSecrets, "secrets"); err != nil { + log.Fatal(err) + } + if err := k.Set(cli.EnvCollectionCharts, "charts"); err != nil { + log.Fatal(err) + } - viper.SetConfigFile(configFile) - viper.AutomaticEnv() - viper.ReadInConfig() + if err := k.Load(file.Provider(configFile), toml.Parser()); err != nil { + log.Fatal(err) + } + if err := k.Load(env.Provider("", ".", func(s string) string { + return strcase.ToDelimited(s, '.') + }), nil); err != nil { + log.Fatal(err) + } } func main() { ctx := context.Background() - databaseURL := viper.GetString(cli.EnvDatabaseURL) - databaseName := viper.GetString(cli.EnvDatabaseName) - collectionNodes := viper.GetString(cli.EnvCollectionSpecs) - collectionSecrets := viper.GetString(cli.EnvCollectionSecrets) - collectionCharts := viper.GetString(cli.EnvCollectionCharts) + databaseURL := k.String(cli.EnvDatabaseURL) + databaseName := k.String(cli.EnvDatabaseName) + collectionNodes := k.String(cli.EnvCollectionSpecs) + collectionSecrets := k.String(cli.EnvCollectionSecrets) + collectionCharts := k.String(cli.EnvCollectionCharts) d := driver.NewInMemoryDriver() defer d.Close(ctx) diff --git a/docs/getting_started.md b/docs/getting_started.md index c040b8c0..45700df2 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -35,13 +35,13 @@ After the build completes, the executable files will be available in the `dist` Settings can be modified using the `.uniflow.toml` file or system environment variables. The key configuration options are: -| TOML Key | Environment Variable Key | Example | -|----------------------|--------------------------|-----------------------------| -| `database.url` | `DATABASE.URL` | `mem://` or `mongodb://` | -| `database.name` | `DATABASE.NAME` | - | -| `collection.charts` | `COLLECTION.CHARTS` | `charts` | -| `collection.specs` | `COLLECTION.SPECS` | `nodes` | -| `collection.secrets` | `COLLECTION.SECRETS` | `secrets` | +| TOML Key | Environment Variable Key | Example | +|----------------------|--------------------------|--------------------------| +| `database.url` | `DATABASE_URL` | `mem://` or `mongodb://` | +| `database.name` | `DATABASE_NAME` | - | +| `collection.charts` | `COLLECTION_CHARTS` | `charts` | +| `collection.specs` | `COLLECTION_SPECS` | `nodes` | +| `collection.secrets` | `COLLECTION_SECRETS` | `secrets` | If you are using [MongoDB](https://www.mongodb.com/), enable [Change Streams](https://www.mongodb.com/docs/manual/changeStreams/) to track resource changes in real time. This requires setting up a [replica set](https://www.mongodb.com/docs/manual/replication/). diff --git a/docs/getting_started_kr.md b/docs/getting_started_kr.md index fb523629..cfc3df3c 100644 --- a/docs/getting_started_kr.md +++ b/docs/getting_started_kr.md @@ -35,13 +35,13 @@ make build 섀정은 `.uniflow.toml` νŒŒμΌμ΄λ‚˜ μ‹œμŠ€ν…œ ν™˜κ²½ λ³€μˆ˜λ₯Ό μ‚¬μš©ν•΄ μœ μ—°ν•˜κ²Œ λ³€κ²½ν•  수 μžˆμŠ΅λ‹ˆλ‹€. μ£Όμš” μ„€μ • ν•­λͺ©μ€ λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€: -| TOML ν‚€ | ν™˜κ²½ λ³€μˆ˜ ν‚€ | μ˜ˆμ‹œ | -|----------------------|-------------------------|----------------------------| -| `database.url` | `DATABASE.URL` | `mem://` λ˜λŠ” `mongodb://` | -| `database.name` | `DATABASE.NAME` | - | -| `collection.charts` | `COLLECTION.CHARTS` | `charts` | -| `collection.specs` | `COLLECTION.SPECS` | `nodes` | -| `collection.secrets` | `COLLECTION.SECRETS` | `secrets` | +| TOML ν‚€ | ν™˜κ²½ λ³€μˆ˜ ν‚€ | μ˜ˆμ‹œ | +|----------------------|----------------------|--------------------------| +| `database.url` | `DATABASE_URL` | `mem://` λ˜λŠ” `mongodb://` | +| `database.name` | `DATABASE_NAME` | - | +| `collection.charts` | `COLLECTION_CHARTS` | `charts` | +| `collection.specs` | `COLLECTION_SPECS` | `nodes` | +| `collection.secrets` | `COLLECTION_SECRETS` | `secrets` | λ§Œμ•½ [MongoDB](https://www.mongodb.com/)λ₯Ό μ‚¬μš©ν•œλ‹€λ©΄, λ¦¬μ†ŒμŠ€μ˜ λ³€κ²½ 사항을 μ‹€μ‹œκ°„μœΌλ‘œ μΆ”μ ν•˜κΈ° μœ„ν•΄ [λ³€κ²½ 슀트림](https://www.mongodb.com/docs/manual/changeStreams/)을 ν™œμ„±ν™”ν•΄μ•Ό ν•©λ‹ˆλ‹€. 이λ₯Ό μœ„ν•΄μ„œλŠ” [볡제 μ„ΈνŠΈ](https://www.mongodb.com/docs/manual/replication/) 섀정이 ν•„μš”ν•©λ‹ˆλ‹€. diff --git a/driver/mongo/pkg/chart/store.go b/driver/mongo/pkg/chart/store.go index 92eeee53..642cd7d8 100644 --- a/driver/mongo/pkg/chart/store.go +++ b/driver/mongo/pkg/chart/store.go @@ -2,13 +2,13 @@ package chart import ( "context" - "github.com/go-playground/validator/v10" - "github.com/siyul-park/uniflow/pkg/encoding" + "github.com/go-playground/validator/v10" "github.com/gofrs/uuid" "github.com/pkg/errors" _ "github.com/siyul-park/uniflow/driver/mongo/pkg/encoding" "github.com/siyul-park/uniflow/pkg/chart" + "github.com/siyul-park/uniflow/pkg/encoding" "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/secret" "go.mongodb.org/mongo-driver/v2/bson" diff --git a/driver/mongo/pkg/chart/store_test.go b/driver/mongo/pkg/chart/store_test.go index dc28801d..946d1dfa 100644 --- a/driver/mongo/pkg/chart/store_test.go +++ b/driver/mongo/pkg/chart/store_test.go @@ -2,9 +2,10 @@ package chart import ( "context" - "github.com/siyul-park/uniflow/pkg/spec" "testing" + "github.com/siyul-park/uniflow/pkg/spec" + "github.com/go-faker/faker/v4" "github.com/gofrs/uuid" "github.com/siyul-park/uniflow/driver/mongo/pkg/server" diff --git a/driver/mongo/pkg/encoding/encoding.go b/driver/mongo/pkg/encoding/encoding.go index 2868e8ce..0156210e 100644 --- a/driver/mongo/pkg/encoding/encoding.go +++ b/driver/mongo/pkg/encoding/encoding.go @@ -1,13 +1,13 @@ package encoding import ( - "go.mongodb.org/mongo-driver/v2/bson" "reflect" "unsafe" "github.com/pkg/errors" "github.com/siyul-park/uniflow/pkg/encoding" "github.com/siyul-park/uniflow/pkg/types" + "go.mongodb.org/mongo-driver/v2/bson" ) func init() { diff --git a/driver/mongo/pkg/secret/store.go b/driver/mongo/pkg/secret/store.go index 42b77606..fcfd6dd0 100644 --- a/driver/mongo/pkg/secret/store.go +++ b/driver/mongo/pkg/secret/store.go @@ -2,12 +2,12 @@ package secret import ( "context" - "github.com/go-playground/validator/v10" - "github.com/siyul-park/uniflow/pkg/encoding" + "github.com/go-playground/validator/v10" "github.com/gofrs/uuid" "github.com/pkg/errors" _ "github.com/siyul-park/uniflow/driver/mongo/pkg/encoding" + "github.com/siyul-park/uniflow/pkg/encoding" "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/secret" "go.mongodb.org/mongo-driver/v2/bson" diff --git a/driver/mongo/pkg/spec/store.go b/driver/mongo/pkg/spec/store.go index b21f917c..72679982 100644 --- a/driver/mongo/pkg/spec/store.go +++ b/driver/mongo/pkg/spec/store.go @@ -2,12 +2,12 @@ package spec import ( "context" - "github.com/go-playground/validator/v10" - "github.com/siyul-park/uniflow/pkg/encoding" + "github.com/go-playground/validator/v10" "github.com/gofrs/uuid" "github.com/pkg/errors" _ "github.com/siyul-park/uniflow/driver/mongo/pkg/encoding" + "github.com/siyul-park/uniflow/pkg/encoding" "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/types" diff --git a/ext/go.mod b/ext/go.mod index 4515024e..e15b7660 100644 --- a/ext/go.mod +++ b/ext/go.mod @@ -23,24 +23,21 @@ require ( require ( cel.dev/expr v0.19.1 // indirect - github.com/gabriel-vasile/mimetype v1.4.7 // indirect - github.com/go-playground/locales v0.14.1 // indirect - github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.23.0 // indirect - github.com/leodido/go-urn v1.4.0 // indirect - golang.org/x/crypto v0.31.0 // indirect -) - -require ( github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/benbjohnson/immutable v0.4.3 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dlclark/regexp2 v1.11.4 // indirect + github.com/gabriel-vasile/mimetype v1.4.7 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.23.0 // indirect github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect github.com/kr/text v0.2.0 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect golang.org/x/net v0.33.0 golang.org/x/sys v0.28.0 // indirect diff --git a/ext/pkg/control/block.go b/ext/pkg/control/block.go index bfeb7d9d..bfbd2d91 100644 --- a/ext/pkg/control/block.go +++ b/ext/pkg/control/block.go @@ -2,6 +2,7 @@ package control import ( "fmt" + "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" diff --git a/ext/pkg/control/block_test.go b/ext/pkg/control/block_test.go index 317164a9..3805bea8 100644 --- a/ext/pkg/control/block_test.go +++ b/ext/pkg/control/block_test.go @@ -1,13 +1,14 @@ package control import ( + "testing" + "github.com/go-faker/faker/v4" "github.com/gofrs/uuid" "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" "github.com/stretchr/testify/assert" - "testing" ) func TestBlockNodeCodec_Compile(t *testing.T) { diff --git a/ext/pkg/control/retry.go b/ext/pkg/control/retry.go index 09f6ef03..68e6bf76 100644 --- a/ext/pkg/control/retry.go +++ b/ext/pkg/control/retry.go @@ -1,6 +1,8 @@ package control import ( + "sync" + "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/packet" "github.com/siyul-park/uniflow/pkg/port" @@ -8,7 +10,6 @@ import ( "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/types" - "sync" ) // RetryNodeSpec defines the configuration for RetryNode. diff --git a/ext/pkg/control/retry_test.go b/ext/pkg/control/retry_test.go index 41e0d1fb..eceab341 100644 --- a/ext/pkg/control/retry_test.go +++ b/ext/pkg/control/retry_test.go @@ -2,6 +2,9 @@ package control import ( "context" + "testing" + "time" + "github.com/go-faker/faker/v4" "github.com/pkg/errors" "github.com/siyul-park/uniflow/pkg/node" @@ -10,8 +13,6 @@ import ( "github.com/siyul-park/uniflow/pkg/process" "github.com/siyul-park/uniflow/pkg/types" "github.com/stretchr/testify/assert" - "testing" - "time" ) func TestRetryNodeCodec_Compile(t *testing.T) { diff --git a/ext/pkg/control/step.go b/ext/pkg/control/step.go index 98afa16e..719ad894 100644 --- a/ext/pkg/control/step.go +++ b/ext/pkg/control/step.go @@ -2,6 +2,7 @@ package control import ( "fmt" + "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" diff --git a/ext/pkg/control/step_test.go b/ext/pkg/control/step_test.go index 8756a4a5..7c77cc47 100644 --- a/ext/pkg/control/step_test.go +++ b/ext/pkg/control/step_test.go @@ -1,13 +1,14 @@ package control import ( + "testing" + "github.com/go-faker/faker/v4" "github.com/gofrs/uuid" "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" "github.com/stretchr/testify/assert" - "testing" ) func TestStepNodeCodec_Compile(t *testing.T) { diff --git a/ext/pkg/control/wait.go b/ext/pkg/control/wait.go index 679863fd..ce9d84b3 100644 --- a/ext/pkg/control/wait.go +++ b/ext/pkg/control/wait.go @@ -1,12 +1,13 @@ package control import ( + "time" + "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/packet" "github.com/siyul-park/uniflow/pkg/process" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" - "time" ) // WaitNodeSpec defines the configuration for WaitNode. diff --git a/ext/pkg/control/wait_test.go b/ext/pkg/control/wait_test.go index 134e04ce..66df25ed 100644 --- a/ext/pkg/control/wait_test.go +++ b/ext/pkg/control/wait_test.go @@ -2,6 +2,9 @@ package control import ( "context" + "testing" + "time" + "github.com/go-faker/faker/v4" "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/packet" @@ -9,8 +12,6 @@ import ( "github.com/siyul-park/uniflow/pkg/process" "github.com/siyul-park/uniflow/pkg/types" "github.com/stretchr/testify/assert" - "testing" - "time" ) func TestWaitNodeCodec_Compile(t *testing.T) { diff --git a/ext/pkg/mime/type_test.go b/ext/pkg/mime/type_test.go index 5251bb0c..6dcacf2c 100644 --- a/ext/pkg/mime/type_test.go +++ b/ext/pkg/mime/type_test.go @@ -2,9 +2,10 @@ package mime import ( "fmt" - "github.com/siyul-park/uniflow/pkg/types" "testing" + "github.com/siyul-park/uniflow/pkg/types" + "github.com/stretchr/testify/assert" ) diff --git a/ext/pkg/system/builder.go b/ext/pkg/system/builder.go index e97f15dd..20c20f55 100644 --- a/ext/pkg/system/builder.go +++ b/ext/pkg/system/builder.go @@ -2,6 +2,8 @@ package system import ( "context" + "reflect" + "github.com/pkg/errors" "github.com/siyul-park/uniflow/pkg/encoding" "github.com/siyul-park/uniflow/pkg/hook" @@ -10,13 +12,12 @@ import ( "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/symbol" "github.com/siyul-park/uniflow/pkg/types" - "reflect" ) -// SchemeRegister manages syscalls and signals for a scheme. +// SchemeRegister manages calls and signals for a scheme. type SchemeRegister struct { - syscalls map[string]func(context.Context, []any) ([]any, error) - signals map[string]func(context.Context) (<-chan any, error) + calls map[string]func(context.Context, []any) ([]any, error) + signals map[string]func(context.Context) (<-chan any, error) } var _ scheme.Register = (*SchemeRegister)(nil) @@ -43,8 +44,8 @@ func AddToHook() hook.Register { // AddToScheme returns a new SchemeRegister instance. func AddToScheme() *SchemeRegister { return &SchemeRegister{ - syscalls: make(map[string]func(context.Context, []any) ([]any, error)), - signals: make(map[string]func(context.Context) (<-chan any, error)), + calls: make(map[string]func(context.Context, []any) ([]any, error)), + signals: make(map[string]func(context.Context) (<-chan any, error)), } } @@ -55,7 +56,7 @@ func (r *SchemeRegister) AddToScheme(s *scheme.Scheme) error { codec scheme.Codec spec spec.Spec }{ - {KindSyscall, NewSyscallNodeCodec(r.syscalls), &SyscallNodeSpec{}}, + {KindSyscall, NewSyscallNodeCodec(r.calls), &SyscallNodeSpec{}}, {KindSignal, NewSignalNodeCodec(r.signals), &SignalNodeSpec{}}, } @@ -98,8 +99,8 @@ func (r *SchemeRegister) Signal(topic string) func(context.Context) (<-chan any, return r.signals[topic] } -// SetSyscall registers a syscall function for a given opcode. -func (r *SchemeRegister) SetSyscall(opcode string, fn any) error { +// SetCalls registers a syscall function for a given opcode. +func (r *SchemeRegister) SetCalls(opcode string, fn any) error { fnValue := reflect.ValueOf(fn) if fnValue.Kind() != reflect.Func { return errors.WithStack(encoding.ErrUnsupportedType) @@ -109,7 +110,7 @@ func (r *SchemeRegister) SetSyscall(opcode string, fn any) error { numIn := fnType.NumIn() numOut := fnType.NumOut() - r.syscalls[opcode] = func(ctx context.Context, arguments []any) ([]any, error) { + r.calls[opcode] = func(ctx context.Context, arguments []any) ([]any, error) { ins := make([]reflect.Value, numIn) offset := 0 @@ -152,7 +153,7 @@ func (r *SchemeRegister) SetSyscall(opcode string, fn any) error { return nil } -// Syscall retrieves the syscall function for a given opcode. -func (r *SchemeRegister) Syscall(opcode string) func(context.Context, []any) ([]any, error) { - return r.syscalls[opcode] +// Call retrieves the syscall function for a given opcode. +func (r *SchemeRegister) Call(opcode string) func(context.Context, []any) ([]any, error) { + return r.calls[opcode] } diff --git a/ext/pkg/system/builder_test.go b/ext/pkg/system/builder_test.go index c0766a67..7c645d7e 100644 --- a/ext/pkg/system/builder_test.go +++ b/ext/pkg/system/builder_test.go @@ -3,14 +3,15 @@ package system import ( "context" "errors" + "testing" + "time" + "github.com/go-faker/faker/v4" "github.com/siyul-park/uniflow/pkg/hook" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/symbol" "github.com/stretchr/testify/assert" - "testing" - "time" ) func TestAddToHook(t *testing.T) { @@ -136,7 +137,7 @@ func TestSchemeRegister_Signal(t *testing.T) { }) } -func TestSchemeRegister_Syscall(t *testing.T) { +func TestSchemeRegister_Call(t *testing.T) { t.Run("func() void", func(t *testing.T) { ctx, cancel := context.WithTimeout(context.TODO(), time.Second) defer cancel() @@ -145,10 +146,10 @@ func TestSchemeRegister_Syscall(t *testing.T) { register := AddToScheme() - err := register.SetSyscall(opcode, func() {}) + err := register.SetCalls(opcode, func() {}) assert.NoError(t, err) - fn := register.Syscall(opcode) + fn := register.Call(opcode) assert.NotNil(t, fn) res, err := fn(ctx, nil) @@ -164,12 +165,12 @@ func TestSchemeRegister_Syscall(t *testing.T) { register := AddToScheme() - err := register.SetSyscall(opcode, func() error { + err := register.SetCalls(opcode, func() error { return errors.New(faker.UUIDHyphenated()) }) assert.NoError(t, err) - fn := register.Syscall(opcode) + fn := register.Call(opcode) assert.NotNil(t, fn) _, err = fn(ctx, nil) @@ -184,12 +185,12 @@ func TestSchemeRegister_Syscall(t *testing.T) { register := AddToScheme() - err := register.SetSyscall(opcode, func(arg string) string { + err := register.SetCalls(opcode, func(arg string) string { return arg }) assert.NoError(t, err) - fn := register.Syscall(opcode) + fn := register.Call(opcode) assert.NotNil(t, fn) arg := faker.UUIDHyphenated() @@ -208,12 +209,12 @@ func TestSchemeRegister_Syscall(t *testing.T) { register := AddToScheme() - err := register.SetSyscall(opcode, func(arg string) (string, error) { + err := register.SetCalls(opcode, func(arg string) (string, error) { return "", errors.New(faker.UUIDHyphenated()) }) assert.NoError(t, err) - fn := register.Syscall(opcode) + fn := register.Call(opcode) assert.NotNil(t, fn) arg := faker.UUIDHyphenated() @@ -230,12 +231,12 @@ func TestSchemeRegister_Syscall(t *testing.T) { register := AddToScheme() - err := register.SetSyscall(opcode, func(_ context.Context, arg string) string { + err := register.SetCalls(opcode, func(_ context.Context, arg string) string { return arg }) assert.NoError(t, err) - fn := register.Syscall(opcode) + fn := register.Call(opcode) assert.NotNil(t, fn) arg := faker.UUIDHyphenated() @@ -254,12 +255,12 @@ func TestSchemeRegister_Syscall(t *testing.T) { register := AddToScheme() - err := register.SetSyscall(opcode, func(_ context.Context, arg string) (string, error) { + err := register.SetCalls(opcode, func(_ context.Context, arg string) (string, error) { return "", errors.New(faker.UUIDHyphenated()) }) assert.NoError(t, err) - fn := register.Syscall(opcode) + fn := register.Call(opcode) assert.NotNil(t, fn) arg := faker.UUIDHyphenated() @@ -276,12 +277,12 @@ func TestSchemeRegister_Syscall(t *testing.T) { register := AddToScheme() - err := register.SetSyscall(opcode, func(arg1, arg2 string) (string, string) { + err := register.SetCalls(opcode, func(arg1, arg2 string) (string, string) { return arg1, arg2 }) assert.NoError(t, err) - fn := register.Syscall(opcode) + fn := register.Call(opcode) assert.NotNil(t, fn) arg := faker.UUIDHyphenated() @@ -301,12 +302,12 @@ func TestSchemeRegister_Syscall(t *testing.T) { register := AddToScheme() - err := register.SetSyscall(opcode, func(arg1, arg2 string) (string, string, error) { + err := register.SetCalls(opcode, func(arg1, arg2 string) (string, string, error) { return "", "", errors.New(faker.UUIDHyphenated()) }) assert.NoError(t, err) - fn := register.Syscall(opcode) + fn := register.Call(opcode) assert.NotNil(t, fn) arg := faker.UUIDHyphenated() diff --git a/ext/pkg/system/signal.go b/ext/pkg/system/signal.go index 0052bf72..b2573861 100644 --- a/ext/pkg/system/signal.go +++ b/ext/pkg/system/signal.go @@ -2,14 +2,14 @@ package system import ( "context" - "github.com/pkg/errors" - "github.com/siyul-park/uniflow/pkg/scheme" "sync" + "github.com/pkg/errors" "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/packet" "github.com/siyul-park/uniflow/pkg/port" "github.com/siyul-park/uniflow/pkg/process" + "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/types" ) @@ -165,23 +165,22 @@ func (n *SignalNode) Close() error { } func (n *SignalNode) emit(sig any) { - var err error - proc := process.New() - defer proc.Exit(err) - - writer := n.outPort.Open(proc) - defer writer.Close() + proc.Exit(func() error { + writer := n.outPort.Open(proc) + defer writer.Close() - payload, err := types.Marshal(sig) - if err != nil { - return - } + payload, err := types.Marshal(sig) + if err != nil { + return err + } - outPck := packet.New(payload) - backPck := packet.Send(writer, outPck) + outPck := packet.New(payload) + backPck := packet.Send(writer, outPck) - if v, ok := backPck.Payload().(types.Error); ok { - err = v.Unwrap() - } + if v, ok := backPck.Payload().(types.Error); ok { + return v.Unwrap() + } + return nil + }()) } diff --git a/ext/pkg/system/signal_test.go b/ext/pkg/system/signal_test.go index 245d40bc..6ce6d9ca 100644 --- a/ext/pkg/system/signal_test.go +++ b/ext/pkg/system/signal_test.go @@ -2,14 +2,15 @@ package system import ( "context" + "testing" + "time" + "github.com/go-faker/faker/v4" "github.com/gofrs/uuid" "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/port" "github.com/siyul-park/uniflow/pkg/process" "github.com/stretchr/testify/assert" - "testing" - "time" ) func TestSignalNodeCodec_Compile(t *testing.T) { diff --git a/ext/pkg/system/syscall.go b/ext/pkg/system/syscall.go index 27a5e65a..2932d614 100644 --- a/ext/pkg/system/syscall.go +++ b/ext/pkg/system/syscall.go @@ -2,6 +2,7 @@ package system import ( "context" + "github.com/pkg/errors" "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/packet" diff --git a/pkg/chart/chart.go b/pkg/chart/chart.go index 72619d36..f06b0427 100644 --- a/pkg/chart/chart.go +++ b/pkg/chart/chart.go @@ -2,6 +2,7 @@ package chart import ( "fmt" + "github.com/gofrs/uuid" "github.com/pkg/errors" "github.com/siyul-park/uniflow/pkg/encoding" diff --git a/pkg/node/port_test.go b/pkg/node/port_test.go index 402da17c..3bd73a9e 100644 --- a/pkg/node/port_test.go +++ b/pkg/node/port_test.go @@ -1,9 +1,9 @@ package node import ( - "github.com/go-faker/faker/v4" "testing" + "github.com/go-faker/faker/v4" "github.com/stretchr/testify/assert" ) diff --git a/pkg/node/proxy_test.go b/pkg/node/proxy_test.go index 05f87861..7ca880f8 100644 --- a/pkg/node/proxy_test.go +++ b/pkg/node/proxy_test.go @@ -1,8 +1,9 @@ package node import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestNoCloser(t *testing.T) { diff --git a/pkg/resource/store.go b/pkg/resource/store.go index 709d4dca..fdfeafbf 100644 --- a/pkg/resource/store.go +++ b/pkg/resource/store.go @@ -2,12 +2,12 @@ package resource import ( "context" - "github.com/go-playground/validator/v10" - "github.com/siyul-park/uniflow/pkg/encoding" "sync" + "github.com/go-playground/validator/v10" "github.com/gofrs/uuid" "github.com/pkg/errors" + "github.com/siyul-park/uniflow/pkg/encoding" ) // Store defines methods for managing Resource objects in a database. @@ -67,8 +67,8 @@ type stream struct { const ( EventStore EventOP = "store" - EventSwap = "swap" - EventDelete = "delete" + EventSwap EventOP = "swap" + EventDelete EventOP = "delete" ) var ErrDuplicatedKey = errors.New("duplicated key") // ErrDuplicatedKey indicates a duplicated key error. diff --git a/pkg/runtime/breakpoint.go b/pkg/runtime/breakpoint.go index 3da4d7f8..87db0512 100644 --- a/pkg/runtime/breakpoint.go +++ b/pkg/runtime/breakpoint.go @@ -1,9 +1,9 @@ package runtime import ( - "github.com/gofrs/uuid" "sync" + "github.com/gofrs/uuid" "github.com/siyul-park/uniflow/pkg/port" "github.com/siyul-park/uniflow/pkg/process" "github.com/siyul-park/uniflow/pkg/symbol" diff --git a/pkg/secret/secret_test.go b/pkg/secret/secret_test.go index 757cca58..c57532b3 100644 --- a/pkg/secret/secret_test.go +++ b/pkg/secret/secret_test.go @@ -1,9 +1,9 @@ package secret import ( - "github.com/go-faker/faker/v4" "testing" + "github.com/go-faker/faker/v4" "github.com/gofrs/uuid" "github.com/stretchr/testify/assert" ) diff --git a/pkg/spec/spec_test.go b/pkg/spec/spec_test.go index 6aec9d16..fd735b8a 100644 --- a/pkg/spec/spec_test.go +++ b/pkg/spec/spec_test.go @@ -1,11 +1,11 @@ package spec import ( - "github.com/siyul-park/uniflow/pkg/secret" "testing" "github.com/go-faker/faker/v4" "github.com/gofrs/uuid" + "github.com/siyul-park/uniflow/pkg/secret" "github.com/stretchr/testify/assert" ) diff --git a/pkg/symbol/cluster.go b/pkg/symbol/cluster.go index 6b355a30..261fe892 100644 --- a/pkg/symbol/cluster.go +++ b/pkg/symbol/cluster.go @@ -1,11 +1,12 @@ package symbol import ( + "sync" + "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/port" "github.com/siyul-park/uniflow/pkg/process" "github.com/siyul-park/uniflow/pkg/spec" - "sync" ) // Cluster manages the ports and symbol table for the cluster. diff --git a/pkg/symbol/cluster_test.go b/pkg/symbol/cluster_test.go index 7400c0f7..50c7b721 100644 --- a/pkg/symbol/cluster_test.go +++ b/pkg/symbol/cluster_test.go @@ -2,6 +2,9 @@ package symbol import ( "context" + "testing" + "time" + "github.com/go-faker/faker/v4" "github.com/gofrs/uuid" "github.com/siyul-park/uniflow/pkg/node" @@ -11,8 +14,6 @@ import ( "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/types" "github.com/stretchr/testify/assert" - "testing" - "time" ) func TestNewCluster(t *testing.T) { diff --git a/pkg/symbol/loader.go b/pkg/symbol/loader.go index 2e18d297..bb44d877 100644 --- a/pkg/symbol/loader.go +++ b/pkg/symbol/loader.go @@ -3,9 +3,9 @@ package symbol import ( "context" "errors" - "github.com/iancoleman/strcase" "reflect" + "github.com/iancoleman/strcase" "github.com/siyul-park/uniflow/pkg/resource" "github.com/siyul-park/uniflow/pkg/scheme" "github.com/siyul-park/uniflow/pkg/secret" diff --git a/pkg/symbol/table.go b/pkg/symbol/table.go index cf1df933..2c2622fe 100644 --- a/pkg/symbol/table.go +++ b/pkg/symbol/table.go @@ -1,14 +1,14 @@ package symbol import ( - "github.com/siyul-park/uniflow/pkg/packet" - "github.com/siyul-park/uniflow/pkg/process" "slices" "sync" "github.com/gofrs/uuid" "github.com/siyul-park/uniflow/pkg/node" + "github.com/siyul-park/uniflow/pkg/packet" "github.com/siyul-park/uniflow/pkg/port" + "github.com/siyul-park/uniflow/pkg/process" "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/types" ) diff --git a/pkg/types/time_test.go b/pkg/types/time_test.go index b99cabc7..ac828dc6 100644 --- a/pkg/types/time_test.go +++ b/pkg/types/time_test.go @@ -1,10 +1,11 @@ package types import ( - "github.com/siyul-park/uniflow/pkg/encoding" - "github.com/stretchr/testify/assert" "testing" "time" + + "github.com/siyul-park/uniflow/pkg/encoding" + "github.com/stretchr/testify/assert" ) func TestTime_Encode(t *testing.T) {