Skip to content

Commit

Permalink
init: goreleaser
Browse files Browse the repository at this point in the history
fdemir committed Nov 27, 2023

Verified

This commit was signed with the committer’s verified signature.
vbudhram Vijay Budhram
1 parent 4cd003e commit 664d3d4
Showing 3 changed files with 64 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/tmp
/tmp
dist/
58 changes: 58 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

brews:
- repository:
owner: fdemir
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
folder: Formula
description: "Havlu lets you focus on the frontend by making it effortless to have a custom API."
license: "MIT"
install: |
bin.install "git-switcher"
14 changes: 4 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import (
"net/http"
"os"
"strconv"
"strings"

"github.com/urfave/cli/v2"
)
@@ -49,22 +50,15 @@ func serve(s *Source, host string, port string, queit bool) {
return
}

// unmarshal query params
result := []interface{}{}
params := r.URL.Query()

limit, err := strconv.Atoi(params.Get("_limit"))
if err != nil {
// do nothing
limit = 0
}
limit, _ := strconv.Atoi(params.Get("_limit"))

if len(params) > 0 {

count := 0

for _, item := range response.([]interface{}) {
if count >= limit {
if limit > 0 && count >= limit {
break
}

@@ -74,7 +68,7 @@ func serve(s *Source, host string, port string, queit bool) {
for key, value := range params {

// if params params does start with underscore, skip
if key[0] == '_' {
if strings.HasPrefix(key, "_") {
continue
}

0 comments on commit 664d3d4

Please sign in to comment.