diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 97e2328..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,2 +0,0 @@ -# These owners will be the default owners for everything in the repo. -* @kataras \ No newline at end of file diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 3b94bfd..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,74 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at kataras2006@hotmail.com. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..af73844 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +github: kataras +# custom: http://iris-go.com/donate diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index e69de29..0000000 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..82ebcb0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG]" +labels: bug +assignees: kataras + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. Windows] + - Version [e.g. 10] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..fe93e3a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for pio +title: "[FEATURE REQUEST]" +labels: enhancement +assignees: kataras + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index ff27c67..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,3 +0,0 @@ -I'd love to see contributions!!! - -Link an [issue](https://github.com/kataras/pio/issues) that your PR tries to solve. \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..20e1ef1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..74c2bad --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + strategy: + matrix: + go_version: [1.19.x] + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go_version }} + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Test + run: go test -v ./... diff --git a/.gitignore b/.gitignore index 08cb523..6789e4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ go.sum +.DS_STORE diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 253ded8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: false -language: go -os: - - linux - - osx -go: - - 1.14.x - - 1.15.x -go_import_path: github.com/kataras/pio -install: - - go get ./... -script: - - go test -v -race -cover ./... -after_script: - # examples - - cd ./_examples - - go get ./... - - go test -v -race -cover ./... diff --git a/LICENSE b/LICENSE index ff5924e..192d4f8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017-2020 Gerasimos Maropoulos. +Copyright (c) 2017-2022 Gerasimos Maropoulos. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 05eae97..717b21d 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ PIO [_Pill for Input/Output_] tries to cure headaches by solving problems where [go](https://golang.org) applications use different kinds of print targets or even loggers. -[![build status](https://img.shields.io/travis/kataras/pio/master.svg?style=flat-square)](https://travis-ci.org/kataras/pio) +[![build status](https://img.shields.io/github/workflow/status/kataras/pio/CI/master?style=for-the-badge)](https://github.com/kataras/pio/actions) [![report card](https://img.shields.io/badge/report%20card-a%2B-ff3333.svg?style=flat-square)](http://goreportcard.com/report/kataras/pio) -[![godocs](https://img.shields.io/badge/online-documentation-0366d6.svg?style=flat-square)](https://godoc.org/github.com/kataras/pio) +[![godocs](https://img.shields.io/badge/online-documentation-0366d6.svg?style=flat-square)](https://pkg.go.dev/github.com/kataras/pio) [![github issues](https://img.shields.io/github/issues/kataras/pio.svg?style=flat-square)](https://github.com/kataras/pio/issues?q=is%3Aopen+is%3Aissue) [![github closed issues](https://img.shields.io/github/issues-closed-raw/kataras/pio.svg?style=flat-square)](https://github.com/kataras/pio/issues?q=is%3Aissue+is%3Aclosed) @@ -16,7 +16,7 @@ Navigate through [_examples](_examples/) and [integrations](_examples/integratio ### 🚀 Installation -The only requirement is the Go Programming Language[*](https://golang.org). +The only requirement is the [Go Programming Language](https://go.dev/dl/). ```bash $ go get github.com/kataras/pio @@ -36,4 +36,4 @@ If you have any previous experience on this field your [PR](https://github.com/k | -----------|--------|-------------| | [golog](https://github.com/kataras/golog) | [Gerasimos Maropoulos](https://github.com/kataras) | Simple, fast and easy-to-use level-based logger written entirely in [GoLang](https://golang.org). | -> Do not hesitate to put your package on this list via [PR](https://github.com/kataras/pio/pulls)! \ No newline at end of file +> Do not hesitate to put your package on this list via [PR](https://github.com/kataras/pio/pulls)! diff --git a/_examples/integrations/logrus/logrus.go b/_examples/integrations/logrus/logrus.go index ccaee67..2465e4b 100644 --- a/_examples/integrations/logrus/logrus.go +++ b/_examples/integrations/logrus/logrus.go @@ -2,13 +2,10 @@ Package logrus registers the global logrus logger to the pio ecosystem, install logrus first: - $ go get github.com/ - Example Code: - package main import ( @@ -19,7 +16,6 @@ Example Code: func main() { pio.Print("This is an info message that will be printed to the logrus' output") } - */ package logrus diff --git a/adapter.go b/adapter.go index c31e4f8..f769405 100644 --- a/adapter.go +++ b/adapter.go @@ -28,9 +28,10 @@ func (w writerFunc) Write(p []byte) (n int, err error) { // std's log.Panicf is not a compatible interface // // output := Output(log.Panicf) -// if IsNop(output) { -// // conversation failed, do something or panic. -//} +// +// if IsNop(output) { +// // conversation failed, do something or panic. +// } func Wrap(printFn interface{}) io.Writer { switch printFn.(type) { case io.Writer: diff --git a/go.mod b/go.mod index 36c3eff..1daf653 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/kataras/pio -go 1.15 +go 1.19 + +require golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 diff --git a/registry.go b/registry.go index 76f6f85..e525395 100644 --- a/registry.go +++ b/registry.go @@ -11,9 +11,10 @@ import ( // // It can be used as follows: // reg := NewRegistry(). -// RegisterPrinter(NewPrinter("err", os.Stderr)). -// RegisterPrinter(NewPrinter("default", os.Stdout)). -// Print("something") +// +// RegisterPrinter(NewPrinter("err", os.Stderr)). +// RegisterPrinter(NewPrinter("default", os.Stdout)). +// Print("something") type Registry struct { // can change via `Register` or `RegisterPrinter` with mutex. // whenever a tool needs an `io.Writer` to do something diff --git a/terminal/terminal_appengine.go b/terminal/terminal_appengine.go index d8be523..4b8bc69 100644 --- a/terminal/terminal_appengine.go +++ b/terminal/terminal_appengine.go @@ -1,3 +1,4 @@ +//go:build appengine // +build appengine package terminal diff --git a/terminal/terminal_bsd.go b/terminal/terminal_bsd.go index 7d4021a..5e477d9 100644 --- a/terminal/terminal_bsd.go +++ b/terminal/terminal_bsd.go @@ -1,3 +1,4 @@ +//go:build (darwin || freebsd || openbsd || netbsd || dragonfly) && !appengine // +build darwin freebsd openbsd netbsd dragonfly // +build !appengine diff --git a/terminal/terminal_linux.go b/terminal/terminal_linux.go index a0056d0..6ffbbcd 100644 --- a/terminal/terminal_linux.go +++ b/terminal/terminal_linux.go @@ -1,3 +1,4 @@ +//go:build !appengine // +build !appengine package terminal diff --git a/terminal/terminal_notwindows.go b/terminal/terminal_notwindows.go index 5ec699f..ef80f5d 100644 --- a/terminal/terminal_notwindows.go +++ b/terminal/terminal_notwindows.go @@ -1,3 +1,4 @@ +//go:build (linux || darwin || freebsd || openbsd || netbsd || dragonfly) && !appengine // +build linux darwin freebsd openbsd netbsd dragonfly // +build !appengine diff --git a/terminal/terminal_solaris.go b/terminal/terminal_solaris.go index 13a362d..57ff5a9 100644 --- a/terminal/terminal_solaris.go +++ b/terminal/terminal_solaris.go @@ -1,3 +1,4 @@ +//go:build solaris && !appengine // +build solaris,!appengine package terminal diff --git a/terminal/terminal_windows.go b/terminal/terminal_windows.go index ed7aedd..3d6a209 100644 --- a/terminal/terminal_windows.go +++ b/terminal/terminal_windows.go @@ -1,3 +1,4 @@ +//go:build windows && !appengine // +build windows,!appengine package terminal