Skip to content

Commit 92d08d3

Browse files
Initial commit
0 parents  commit 92d08d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4231
-0
lines changed

.editorconfig

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
# Use tabs for indentation (Makefiles require tabs)
17+
indent_style = tab

.gitattributes

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Go source files always have LF line endings.
5+
# Windows users contributing to Go will need to use a
6+
# modern version of git and editors capable of LF line endings.
7+
*.go text eol=lf diff=golang

.github/ISSUE_TEMPLATE/bug_report.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: "\U0001F41B Bug Report"
3+
about: "If something isn't working as expected \U0001F914."
4+
title: ''
5+
labels: 'i: bug, i: needs triage'
6+
assignees: ''
7+
8+
---
9+
10+
## Bug Report
11+
12+
**Current Behavior**
13+
A clear and concise description of the behavior.
14+
15+
**Input Code**
16+
- REPL or Repo link if applicable:
17+
18+
Check out [repl.it](https://repl.it/languages/go) if you need a Golang REPL.
19+
20+
```go
21+
a := "Incroyable"
22+
fmt.Println(a)
23+
```
24+
25+
**Expected behavior/code**
26+
A clear and concise description of what you expected to happen (or code).
27+
28+
**Environment**
29+
- Go version: [e.g. v1.16]
30+
- OS: [e.g. macOS Big Sur 11, Windows 10]
31+
- Container: [e.g. yes/no/Docker/Kubernetes]
32+
33+
**Possible Solution**
34+
<!--- Only if you have suggestions on a fix for the bug -->
35+
36+
**Additional context/Screenshots**
37+
Add any other context about the problem here. If applicable, add screenshots to help explain.
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: "\U0001F680 Feature Request"
3+
about: "I have a suggestion (and may want to implement it \U0001F642)!"
4+
title: ''
5+
labels: 'i: enhancement, i: needs triage'
6+
assignees: ''
7+
8+
---
9+
10+
## Feature Request
11+
12+
**Is your feature request related to a problem? Please describe.**
13+
A clear and concise description of what the problem is. Ex. I have an issue when [...]
14+
15+
**Describe the solution you'd like**
16+
A clear and concise description of what you want to happen. Add any considered drawbacks.
17+
18+
**Describe alternatives you've considered**
19+
A clear and concise description of any alternative solutions or features you've considered.
20+
21+
**Teachability, Documentation, Adoption, Migration Strategy**
22+
If you can, explain how users will be able to use this and possibly write out a version the docs.
23+
Maybe a screenshot or design?
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Pull Request template
2+
Please, go through these steps before you submit a PR.
3+
4+
1. Make sure that your PR is not a duplicate.
5+
2. If not, then make sure that:
6+
7+
a. You have done your changes in a separate branch. Branches MUST have descriptive names that start with either the `fix/` or `feature/` prefixes. Good examples are: `fix/signin-issue` or `feature/issue-templates`.
8+
9+
b. You have a descriptive commit message with a short title (first line).
10+
11+
c. `go test -v ./...` and `go build -v .` doesn't throw any error. If it does, fix them first and amend your commit (`git commit --amend`).
12+
13+
d. You have executed `gofmt -w .` to format all source code.
14+
15+
3. **After** these steps, you're ready to open a pull request.
16+
17+
a. Your pull request MUST target the `main` branch on this repository.
18+
19+
b. Give a descriptive title to your PR.
20+
21+
c. Provide a description of your changes.
22+
23+
d. Put `closes #XXXX` or `fixes #XXXX` in your comment to auto-close the issue that your PR fixes (if such).
24+
25+
**PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING**

.github/labeler.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Add 'repo' label to any root file changes
2+
repo:
3+
- ./*

.github/workflows/label.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This workflow will triage pull requests and apply a label based on the
2+
# paths that are modified in the pull request.
3+
#
4+
# To use this workflow, you will need to set up a .github/labeler.yml
5+
# file with configuration. For more information, see:
6+
# https://github.com/actions/labeler
7+
8+
name: Labeler
9+
on: [pull_request]
10+
11+
jobs:
12+
label:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/labeler@v2
18+
with:
19+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/main.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
build:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
steps:
15+
16+
- name: Set up Go 1.x
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: ^1.16
20+
id: go
21+
22+
- name: Check out code into the Go module directory
23+
uses: actions/checkout@v2
24+
25+
- name: Build
26+
run: go build -v .
27+
28+
- name: Test
29+
run: go test -v ./...

.github/workflows/stale.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Mark stale issues and pull requests
2+
3+
on:
4+
schedule:
5+
- cron: "0 5 * * 0"
6+
7+
jobs:
8+
stale:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/stale@v1
14+
with:
15+
repo-token: ${{ secrets.GITHUB_TOKEN }}
16+
stale-issue-message: 'Stale issue message'
17+
stale-pr-message: 'Stale pull request message'
18+
stale-issue-label: 'no-issue-activity'
19+
stale-pr-label: 'no-pr-activity'

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
coverage.html
14+
15+
# SSL Certificate
16+
cert.pem
17+
key.pem
18+
19+
# SonarQube
20+
.cache
21+
.scannerwork

.vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[go]": {
3+
"editor.formatOnSave": true
4+
},
5+
"go.testFlags": ["-v"]
6+
}

Makefile

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!make
2+
3+
PASSWORD:=lungo
4+
PROJECT_NAME:=lungo
5+
PROJECT_KEY:=com.github.felix-kaestner.lungo
6+
7+
PWD:=$(shell pwd)
8+
TIME:=$(shell date +%s)
9+
UID:=$(shell id -u)
10+
GID:=$(shell id -g)
11+
12+
docs:
13+
@godoc -http=:6060
14+
15+
fmt:
16+
@gofmt -w .
17+
18+
test:
19+
@go test -v ./...
20+
21+
coverage:
22+
@go test ./... -cover -coverprofile=coverage.out
23+
@go tool cover -html=coverage.out -o coverage.html
24+
25+
sonar:
26+
@docker-compose up -d
27+
@echo -n "Waiting for Sonarqube to start..."
28+
@until curl -u admin:admin -s http://localhost:9000/system/info > /dev/null 2>&1; do echo -n "."; sleep 1; done
29+
@until curl -u admin:admin -s http://localhost:9000/api/authentication/validate | grep '"valid":true' > /dev/null 2>&1; do echo -n "."; sleep 1; done
30+
@curl -u admin:admin -X POST -s "http://localhost:9000/api/users/change_password?login=admin&previousPassword=admin&password=$(PASSWORD)"
31+
@curl -u admin:$(PASSWORD) -X POST -s "http://localhost:9000/api/projects/create?name=$(PROJECT_NAME)&project=$(PROJECT_KEY)" > /dev/null
32+
33+
lint: coverage
34+
@set -e; \
35+
SONAR_LOGIN=$$(curl -u admin:$(PASSWORD) -X POST -s "http://localhost:9000/api/user_tokens/generate?name=$(TIME)" | jq '.token'); \
36+
sh -c "docker run --rm --user="$(UID):$(GID)" --network sonarqube -v $(PWD):/usr/src sonarsource/sonar-scanner-cli:4.6 sonar-scanner -Dsonar.login=$$SONAR_LOGIN -Dsonar.projectName=$(PROJECT_NAME) -Dsonar.projectKey=$(PROJECT_KEY) -Dsonar.host.url=http://sonarqube:9000 -Dsonar.exclusions='**/*_test.go' -Dsonar.test.inclusions='**/*_test.go' -Dsonar.coverage.exclusions='assert.go,lungo.go,**/*config.go' -Dsonar.go.coverage.reportPaths=coverage.out"
37+
38+
clean:
39+
@docker-compose down -v
40+
@rm -rf coverage.html coverage.out cert.pem key.pem .scannerwork .cache

README.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Lungo
2+
3+
<p align="center">
4+
<span>A tiny, zero-dependency web framework based on net/http with an intuitive API.</span>
5+
<br><br>
6+
<a href="https://github.com/felix-kaestner/lungo/issues">
7+
<img alt="Issues" src="https://img.shields.io/github/issues/felix-kaestner/lungo?color=29b6f6&style=flat-square">
8+
</a>
9+
<a href="https://github.com/felix-kaestner/lungo/stargazers">
10+
<img alt="Stars" src="https://img.shields.io/github/stars/felix-kaestner/lungo?color=29b6f6&style=flat-square">
11+
</a>
12+
<a href="https://github.com/felix-kaestner/lungo/blob/main/LICENSE">
13+
<img alt="License" src="https://img.shields.io/github/license/felix-kaestner/lungo?color=29b6f6&style=flat-square">
14+
</a>
15+
<a href="https://twitter.com/kaestner_felix">
16+
<img alt="Twitter" src="https://img.shields.io/badge/twitter-@kaestner_felix-29b6f6?style=flat-square">
17+
</a>
18+
</p>
19+
20+
## Quickstart
21+
22+
```go
23+
package main
24+
25+
import "github.com/felix-kaestner/lungo"
26+
27+
func main() {
28+
app := lungo.New()
29+
30+
app.Get("/", func(c *lungo.Context) error {
31+
return c.Text("Hello, World!")
32+
})
33+
34+
app.Listen(":3000")
35+
}
36+
```
37+
38+
## Installation
39+
40+
Install Lungo with the `go get` command:
41+
42+
```
43+
$ go get -u github.com/felix-kaestner/lungo
44+
```
45+
46+
## Contribute
47+
48+
All contributions in any form are welcome! 🙌
49+
Just use the [Issue](.github/ISSUE_TEMPLATE) and [Pull Request](.github/PULL_REQUEST_TEMPLATE) templates and
50+
I will be happy to review your suggestions. 👍
51+
52+
## Support
53+
54+
Any kind of support is well appreciated! 👏
55+
If you want to tweet about the project, make sure to tag me [@kaestner_felix](https://twitter.com/kaestner_felix). You can also support my open source work on [GitHub Sponsors](https://github.com/sponsors/felix-kaestner). All income will be directly invested in Coffee (specifically Lungo) ☕!
56+
57+
## Cheers ✌

0 commit comments

Comments
 (0)