Skip to content

Commit

Permalink
up: rename interface DataMarshaler to DataParser
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jul 20, 2022
1 parent 9cc272b commit 185c68c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 15 deletions.
37 changes: 37 additions & 0 deletions .github/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
title: '## Change Log'
# style allow: simple, markdown(mkdown), ghr(gh-release)
style: gh-release
# group names
names: [Refactor, Fixed, Feature, Update, Other]
# if empty will auto fetch by git remote
#repo_url: https://github.com/gookit/gitw

filters:
# message length should >= 12
- name: msg_len
min_len: 12
# message words should >= 3
- name: words_len
min_len: 3
- name: keyword
keyword: format code
exclude: true
- name: keywords
keywords: format code, action test
exclude: true

# group match rules
# not matched will use 'Other' group.
rules:
- name: Refactor
start_withs: [refactor, break]
contains: ['refactor:']
- name: Fixed
start_withs: [fix]
contains: ['fix:']
- name: Feature
start_withs: [feat, new]
contains: ['feat:']
- name: Update
start_withs: [update, 'up:']
contains: ['update:']
25 changes: 16 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,33 @@ jobs:
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
go: [1.17]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup ENV
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
- name: Display Env
run: env
- name: Generate changelog
run: |
curl https://github.com/gookit/gitw/releases/latest/download/chlog-linux-amd64 -L -o /usr/local/bin/chlog
chmod a+x /usr/local/bin/chlog
chlog -c .github/changelog.yml -o changelog.md prev last
# https://github.com/actions/create-release
- uses: meeDamian/github-release@v2.0.3
# https://github.com/softprops/action-gh-release
- name: Create release and upload assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
gzip: false
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TAG }}
tag_name: ${{ env.RELEASE_TAG }}
body_path: changelog.md
token: ${{ secrets.GITHUB_TOKEN }}
# files: macos-chlog.exe
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ go get github.com/gookit/gsr

- [logger](logger.go)
- [cacher](cacher.go)
- [marshaler](marshaler.go)
- [parser](parser.go)

## Usage

Expand Down Expand Up @@ -75,11 +75,11 @@ func (ma *MyApp) SetCacher(cacher gsr.SimpleCacher) {
}
```

### Marshaler interface
### DataParser interface

```go
// Marshaler interface for Marshal/Unmarshal data
type Marshaler interface {
// DataParser interface for Marshal/Unmarshal data
type DataParser interface {
Marshal(v interface{}) ([]byte, error)
Unmarshal(data []byte, ptr interface{}) error
}
Expand Down
4 changes: 2 additions & 2 deletions marshaler.go → parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ type Unmarshaler interface {
Unmarshal(v []byte, ptr interface{}) error
}

// DataMarshaler interface for Marshal/Unmarshal data
type DataMarshaler interface {
// DataParser interface for Marshal/Unmarshal data
type DataParser interface {
Marshaler
Unmarshaler
}
Expand Down

0 comments on commit 185c68c

Please sign in to comment.