Skip to content

Commit

Permalink
Merge pull request #1 from tunabay/init-ver
Browse files Browse the repository at this point in the history
Initial version.
  • Loading branch information
tunabay authored Nov 6, 2022
2 parents 1ed457d + 62c4633 commit 7299f18
Show file tree
Hide file tree
Showing 20 changed files with 1,693 additions and 1 deletion.
99 changes: 99 additions & 0 deletions .ci/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
run:
timeout: 5m
tests: true
fast: false
skip-dirs-use-default: true
print-issued-lines: true
print-linter-name: true

linters:
disable-all: true
fast: false
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused

- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- dogsled
- dupword
- errchkjson
- errname
- errorlint
- exportloopref
- forbidigo
- forcetypeassert
- goconst
- gocritic
- goerr113
- gofmt
- gofumpt
- goimports
- gomodguard
- goprintffuncname
- gosec
- importas
- misspell
- noctx
- nolintlint
- nosprintfhostport
- prealloc
- predeclared
- reassign
- revive
- stylecheck
- testpackage
- testableexamples
- thelper
- unconvert
- unparam
- usestdlibvars
- whitespace
- wrapcheck

linters-settings:
gofumpt:
lang-version: "1.19"
gosimple:
go: "1.19"
staticcheck:
go: "1.19"
stylecheck:
go: "1.19"
unused:
go: "1.19"

misspell:
locale: US

errcheck:
exclude-functions:
- io/ioutil.ReadFile
- io.Copy(*bytes.Buffer)
- io.Copy(os.Stdout)
- (*github.com/tunabay/go-bitarray.Builder).WriteBit
- (*github.com/tunabay/go-bitarray.Builder).WriteByte
- (*github.com/tunabay/go-bitarray.Builder).WriteBitArray

issues:
max-issues-per-linter: 0
max-same-issues: 0
fix: false

exclude-use-default: true
exclude-rules:

# ignore in unit tests
- linters: [ gosec, goerr113, ifshort ]
path: "_test\\.go$"
- linters: [ staticcheck ]
text: "^SA9003: empty branch"
34 changes: 34 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: go-test
on:
push:
tags:
- v*
branches-ignore:
- 'doc-*'
- 'doc/*'
pull_request:
branches:
- main
- master
- release
jobs:
go-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ^1.19
- uses: actions/checkout@v3
- name: go-test
run: |
go test -v -count=1 \
-covermode=count \
-coverpkg=github.com/tunabay/go-filecache \
-coverprofile=cover.out \
./...
go tool cover -func=cover.out
go tool cover -html=cover.out -o go-test-coverage.html
- uses: actions/upload-artifact@v3
with:
path: go-test-coverage.html
retention-days: 3
31 changes: 31 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: golangci-lint
on:
push:
tags:
- v*
branches-ignore:
- 'doc-*'
- 'doc/*'
pull_request:
branches:
- main
- master
- release
jobs:
golangci:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ^1.19
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50
only-new-issues: true
skip-go-installation: true
args: >-
--verbose
--issues-exit-code=1
--config=.ci/golangci-lint.yml
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2022 Hirotsuna Mizuno - https://github.com/tunabay

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# go-filecache
# go-filecache

[![Go Reference](https://pkg.go.dev/badge/github.com/tunabay/go-filecache.svg)](https://pkg.go.dev/github.com/tunabay/go-filecache)
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)


## Overview

Package filecache provides a LRU file caching mechanism to cache resources to
the local disk that take a long time to generate or download from the network.

The creation process runs only once even if multiple go-routines concurrently
request for a key that does not exist in the cache.


## Documentation

- Read the [documentation](https://pkg.go.dev/github.com/tunabay/go-filecache).


## License

go-filecache is available under the MIT license. See the [LICENSE](LICENSE) file
for more information.
Loading

0 comments on commit 7299f18

Please sign in to comment.