Skip to content

Commit

Permalink
Transfer ownership to Naughty Gopher (#51)
Browse files Browse the repository at this point in the history
[-] transfer ownership to Naughty Gopher
[-] updated all the badges on README
[-] updated GH workflow to the newest one being used in other projects
  • Loading branch information
bnkamalesh authored Oct 20, 2024
1 parent 9882f0c commit 5db2b6b
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 136 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Build
run: go build -v ./...

- name: Tests
run: |
go install github.com/mattn/goveralls@latest
go test -covermode atomic -coverprofile=covprofile ./...
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: covprofile

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
46 changes: 0 additions & 46 deletions .github/workflows/golangci-lint.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/tests.yaml

This file was deleted.

9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
Contributions are welcome from everyone. Please adhere to the [code of conduct](https://github.com/bnkamalesh/webgo/blob/master/CODE_OF_CONDUCT.md) of the project, and be respectful to all.
Contributions are welcome from everyone. Please adhere to the [code of conduct](https://github.com/naughtygopher/webgo/blob/master/CODE_OF_CONDUCT.md) of the project, and be respectful to all.

Please follow the guidelines provided for contribution

1. Updates to the project are only accepted via Pull Requests (PR)
2. Pull requests will be reviewed & tested
3. Every PR should be accompanied by its test wherever applicable
4. While creating an issue
1. Mention the steps to reproduce the issue
2. Mention the environment in which it was run
3. Include your 1st level of troubleshooting results
1. Mention the steps to reproduce the issue
2. Mention the environment in which it was run
3. Include your 1st level of troubleshooting results
5. Provide meaningful commit messages


### Versioning & PR messages

WebGo tries to use [semantic versioning](https://semver.org/) and starting recently, have decided to adhere to the following syntax in PR description. List down the changes as bulleted list, as follows:
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Kamaleshwar
Copyright (c) 2024 Naughty Gopher

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ 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.
SOFTWARE.
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<p align="center"><img src="https://user-images.githubusercontent.com/1092882/60883564-20142380-a268-11e9-988a-d98fb639adc6.png" alt="webgo gopher" width="256px"/></p>

[![](https://github.com/bnkamalesh/webgo/actions/workflows/tests.yaml/badge.svg)](https://github.com/bnkamalesh/webgo/actions/workflows/tests.yaml)
[![coverage](https://img.shields.io/codecov/c/github/bnkamalesh/webgo.svg)](https://codecov.io/gh/bnkamalesh/webgo)
[![](https://goreportcard.com/badge/github.com/bnkamalesh/webgo)](https://goreportcard.com/report/github.com/bnkamalesh/webgo)
[![](https://api.codeclimate.com/v1/badges/85b3a55c3fa6b4c5338d/maintainability)](https://codeclimate.com/github/bnkamalesh/webgo/maintainability)
[![](https://godoc.org/github.com/nathany/looper?status.svg)](http://godoc.org/github.com/bnkamalesh/webgo)
[![](https://github.com/naughtygopher/webgo/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/naughtygopher/webgo/actions)
[![Go Reference](https://pkg.go.dev/badge/github.com/naughtygopher/webgo.svg)](https://pkg.go.dev/github.com/naughtygopher/webgo)
[![Go Report Card](https://goreportcard.com/badge/github.com/naughtygopher/webgo)](https://goreportcard.com/report/github.com/naughtygopher/webgo)
[![Coverage Status](https://coveralls.io/repos/github/naughtygopher/webgo/badge.svg?branch=master)](https://coveralls.io/github/naughtygopher/webgo?branch=master)
[![](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go#web-frameworks)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/creativecreature/sturdyc/blob/master/LICENSE)

# WebGo v7.0.4

WebGo is a minimalistic router for [Go](https://golang.org) to build web applications (server side) with no 3rd party dependencies. WebGo will always be Go standard library compliant; with the HTTP handlers having the same signature as [http.HandlerFunc](https://golang.org/pkg/net/http/#HandlerFunc).

### Contents

1. [Router](https://github.com/bnkamalesh/webgo#router)
2. [Handler chaining](https://github.com/bnkamalesh/webgo#handler-chaining)
3. [Middleware](https://github.com/bnkamalesh/webgo#middleware)
4. [Error handling](https://github.com/bnkamalesh/webgo#error-handling)
5. [Helper functions](https://github.com/bnkamalesh/webgo#helper-functions)
6. [HTTPS ready](https://github.com/bnkamalesh/webgo#https-ready)
7. [Graceful shutdown](https://github.com/bnkamalesh/webgo#graceful-shutdown)
8. [Logging](https://github.com/bnkamalesh/webgo#logging)
9. [Server-Sent Events](https://github.com/bnkamalesh/webgo#server-sent-events)
10. [Usage](https://github.com/bnkamalesh/webgo#usage)
1. [Router](https://github.com/naughtygopher/webgo#router)
2. [Handler chaining](https://github.com/naughtygopher/webgo#handler-chaining)
3. [Middleware](https://github.com/naughtygopher/webgo#middleware)
4. [Error handling](https://github.com/naughtygopher/webgo#error-handling)
5. [Helper functions](https://github.com/naughtygopher/webgo#helper-functions)
6. [HTTPS ready](https://github.com/naughtygopher/webgo#https-ready)
7. [Graceful shutdown](https://github.com/naughtygopher/webgo#graceful-shutdown)
8. [Logging](https://github.com/naughtygopher/webgo#logging)
9. [Server-Sent Events](https://github.com/naughtygopher/webgo#server-sent-events)
10. [Usage](https://github.com/naughtygopher/webgo#usage)

## Router

Expand All @@ -31,13 +31,13 @@ Webgo has a simplistic, linear path matching router and supports defining [URI](
1. `/api/users` - URI with no dynamic values
2. `/api/users/:userID`
- URI with a named parameter, `userID`
- If TrailingSlash is set to true, it will accept the URI ending with a '/', refer to [sample](https://github.com/bnkamalesh/webgo#sample)
- If TrailingSlash is set to true, it will accept the URI ending with a '/', refer to [sample](https://github.com/naughtygopher/webgo#sample)
3. `/api/users/:misc*`
- Named URI parameter `misc`, with a wildcard suffix '\*'
- This matches everything after `/api/users`. e.g. `/api/users/a/b/c/d`

When there are multiple handlers matching the same URI, only the first occurring handler will handle the request.
Refer to the [sample](https://github.com/bnkamalesh/webgo#sample) to see how routes are configured. You can access named parameters of the URI using the `Context` function.
Refer to the [sample](https://github.com/naughtygopher/webgo#sample) to see how routes are configured. You can access named parameters of the URI using the `Context` function.

Note: webgo Context is **not** available inside the special handlers (not found & method not implemented)

Expand All @@ -62,11 +62,11 @@ func helloWorld(w http.ResponseWriter, r *http.Request) {

## Handler chaining

Handler chaining lets you execute multiple handlers for a given route. Execution of a chain can be configured to run even after a handler has written a response to the HTTP request, if you set `FallThroughPostResponse` to `true` (refer [sample](https://github.com/bnkamalesh/webgo/blob/master/cmd/main.go#L70)).
Handler chaining lets you execute multiple handlers for a given route. Execution of a chain can be configured to run even after a handler has written a response to the HTTP request, if you set `FallThroughPostResponse` to `true` (refer [sample](https://github.com/naughtygopher/webgo/blob/master/cmd/main.go#L70)).

## Middleware

WebGo [middlware](https://godoc.org/github.com/bnkamalesh/webgo#Middleware) lets you wrap all the routes with a middleware unlike handler chaining. The router exposes a method [Use](https://godoc.org/github.com/bnkamalesh/webgo#Router.Use) && [UseOnSpecialHandlers](https://godoc.org/github.com/bnkamalesh/webgo#Router.UseOnSpecialHandlers) to add a Middleware to the router.
WebGo [middlware](https://godoc.org/github.com/naughtygopher/webgo#Middleware) lets you wrap all the routes with a middleware unlike handler chaining. The router exposes a method [Use](https://godoc.org/github.com/naughtygopher/webgo#Router.Use) && [UseOnSpecialHandlers](https://godoc.org/github.com/naughtygopher/webgo#Router.UseOnSpecialHandlers) to add a Middleware to the router.

NotFound && NotImplemented are considered `Special` handlers. `webgo.Context(r)` within special handlers will return `nil`.

Expand All @@ -83,11 +83,11 @@ func main() {

## Error handling

Webgo context has 2 methods to [set](https://github.com/bnkamalesh/webgo/blob/master/webgo.go#L60) & [get](https://github.com/bnkamalesh/webgo/blob/master/webgo.go#L66) erro within a request context. It enables Webgo to implement a single middleware where you can handle error returned within an HTTP handler. [set error](https://github.com/bnkamalesh/webgo/blob/master/cmd/main.go#L45), [get error](https://github.com/bnkamalesh/webgo/blob/master/cmd/main.go#L51).
Webgo context has 2 methods to [set](https://github.com/naughtygopher/webgo/blob/master/webgo.go#L60) & [get](https://github.com/naughtygopher/webgo/blob/master/webgo.go#L66) erro within a request context. It enables Webgo to implement a single middleware where you can handle error returned within an HTTP handler. [set error](https://github.com/naughtygopher/webgo/blob/master/cmd/main.go#L45), [get error](https://github.com/naughtygopher/webgo/blob/master/cmd/main.go#L51).

## Helper functions

WebGo provides a few helper functions. When using `Send` or `SendResponse` (other Rxxx responder functions), the response is wrapped in WebGo's [response struct](https://github.com/bnkamalesh/webgo/blob/master/responses.go#L17) and is serialized as JSON.
WebGo provides a few helper functions. When using `Send` or `SendResponse` (other Rxxx responder functions), the response is wrapped in WebGo's [response struct](https://github.com/naughtygopher/webgo/blob/master/responses.go#L17) and is serialized as JSON.

```json
{
Expand All @@ -96,7 +96,7 @@ WebGo provides a few helper functions. When using `Send` or `SendResponse` (othe
}
```

When using `SendError`, the response is wrapped in WebGo's [error response struct](https://github.com/bnkamalesh/webgo/blob/master/responses.go#L23) and is serialzied as JSON.
When using `SendError`, the response is wrapped in WebGo's [error response struct](https://github.com/naughtygopher/webgo/blob/master/responses.go#L23) and is serialzied as JSON.

```json
{
Expand Down Expand Up @@ -190,7 +190,7 @@ func main() {

## Logging

WebGo exposes a singleton & global scoped logger variable [LOGHANDLER](https://godoc.org/github.com/bnkamalesh/webgo#Logger) with which you can plug in your custom logger by implementing the [Logger](https://godoc.org/github.com/bnkamalesh/webgo#Logger) interface.
WebGo exposes a singleton & global scoped logger variable [LOGHANDLER](https://godoc.org/github.com/naughtygopher/webgo#Logger) with which you can plug in your custom logger by implementing the [Logger](https://godoc.org/github.com/naughtygopher/webgo#Logger) interface.

### Configuring the default Logger

Expand All @@ -202,7 +202,7 @@ The default logger uses Go standard library's `log.Logger` with `os.Stdout` (for

## Usage

A fully functional sample is provided [here](https://github.com/bnkamalesh/webgo/blob/master/cmd/main.go).
A fully functional sample is provided [here](https://github.com/naughtygopher/webgo/blob/master/cmd/main.go).

### Benchmark

Expand All @@ -211,11 +211,11 @@ A fully functional sample is provided [here](https://github.com/bnkamalesh/webgo

### Contributing

Refer [here](https://github.com/bnkamalesh/webgo/blob/master/CONTRIBUTING.md) to find out details about making a contribution
Refer [here](https://github.com/naughtygopher/webgo/blob/master/CONTRIBUTING.md) to find out details about making a contribution

### Credits

Thanks to all the [contributors](https://github.com/bnkamalesh/webgo/graphs/contributors)
Thanks to all the [contributors](https://github.com/naughtygopher/webgo/graphs/contributors)

## The gopher

Expand Down
10 changes: 4 additions & 6 deletions cmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ If you have Go installed on your computer, open the terminal and:

```bash
$ cd $GOPATH/src
$ mkdir -p github.com/bnkamalesh
$ cd github.com/bnkamalesh
$ git clone https://github.com/bnkamalesh/webgo.git
$ git clone https://github.com/naughtygopher/webgo.git
$ cd webgo/cmd
$ go run *.go

Expand All @@ -31,13 +29,13 @@ Info 2023/02/05 08:51:26 HTTPS server, listening on :9595
Or if you have [Docker](https://www.docker.com/), open the terminal and:

```bash
$ git clone https://github.com/bnkamalesh/webgo.git
$ git clone https://github.com/naughtygopher/webgo.git
$ cd webgo
$ docker run \
-p 8080:8080 \
-p 9595:9595 \
-v ${PWD}:/go/src/github.com/bnkamalesh/webgo/ \
-w /go/src/github.com/bnkamalesh/webgo/cmd \
-v ${PWD}:/go/src/github.com/naughtygopher/webgo/ \
-w /go/src/github.com/naughtygopher/webgo/cmd \
--rm -ti golang:latest go run *.go

Info 2023/02/05 08:51:26 HTTP server, listening on :8080
Expand Down
4 changes: 2 additions & 2 deletions cmd/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"os"
"strings"

"github.com/bnkamalesh/webgo/v7"
"github.com/bnkamalesh/webgo/v7/extensions/sse"
"github.com/naughtygopher/webgo/v7"
"github.com/naughtygopher/webgo/v7/extensions/sse"
)

// StaticFilesHandler is used to serve static files
Expand Down
8 changes: 4 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"strings"
"time"

"github.com/bnkamalesh/webgo/v7"
"github.com/bnkamalesh/webgo/v7/extensions/sse"
"github.com/bnkamalesh/webgo/v7/middleware/accesslog"
"github.com/bnkamalesh/webgo/v7/middleware/cors"
"github.com/naughtygopher/webgo/v7"
"github.com/naughtygopher/webgo/v7/extensions/sse"
"github.com/naughtygopher/webgo/v7/middleware/accesslog"
"github.com/naughtygopher/webgo/v7/middleware/cors"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions cmd/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
<p class="tags" align="justify">
<a href="https://codecov.io/gh/bnkamalesh/webgo"><img
src="https://img.shields.io/codecov/c/github/bnkamalesh/webgo.svg" alt="coverage"></a>
<a href="https://goreportcard.com/report/github.com/bnkamalesh/webgo"><img
src="https://goreportcard.com/badge/github.com/bnkamalesh/webgo" alt=""></a>
<a href="https://goreportcard.com/report/github.com/naughtygopher/webgo"><img
src="https://goreportcard.com/badge/github.com/naughtygopher/webgo" alt=""></a>
<a href="https://codeclimate.com/github/bnkamalesh/webgo/maintainability"><img
src="https://api.codeclimate.com/v1/badges/85b3a55c3fa6b4c5338d/maintainability" alt=""></a>
<a href="http://godoc.org/github.com/bnkamalesh/webgo"><img
<a href="http://godoc.org/github.com/naughtygopher/webgo"><img
src="https://godoc.org/github.com/nathany/looper?status.svg" alt=""></a>
<a href="https://github.com/avelino/awesome-go#web-frameworks"><img
src="https://awesome.re/mentioned-badge.svg" alt=""></a>
Expand Down
2 changes: 1 addition & 1 deletion extensions/sse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It provides the following hooks for customizing the workflows:

```golang
import (
"github.com/bnkamalesh/webgo/extensions/sse"
"github.com/naughtygopher/webgo/extensions/sse"
)
func main() {
sseService := sse.New()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/bnkamalesh/webgo/v7
module github.com/naughtygopher/webgo/v7

go 1.22
2 changes: 1 addition & 1 deletion middleware/accesslog/accesslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"net/http"
"time"

"github.com/bnkamalesh/webgo/v7"
"github.com/naughtygopher/webgo/v7"
)

// AccessLog is a middleware which prints access log to stdout
Expand Down
2 changes: 1 addition & 1 deletion middleware/accesslog/accesslog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"testing"
"time"

"github.com/bnkamalesh/webgo/v7"
"github.com/naughtygopher/webgo/v7"
)

func TestAccessLog(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion middleware/cors/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"sort"
"strings"

"github.com/bnkamalesh/webgo/v7"
"github.com/naughtygopher/webgo/v7"
)

const (
Expand Down
Loading

0 comments on commit 5db2b6b

Please sign in to comment.