Skip to content

Commit 293ee3b

Browse files
committed
docs(examples): add a non-echo example for authenticated APIs
A question on Slack[0] highlighted that we should really have an example of how to do this, without using a framework. For now, we can do this using `std-http`. [0]: https://gophers.slack.com/archives/C029RQSEE/p1716899803702469
1 parent da9077b commit 293ee3b

File tree

12 files changed

+1381
-0
lines changed

12 files changed

+1381
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
SHELL:=/bin/bash
2+
3+
YELLOW := \e[0;33m
4+
RESET := \e[0;0m
5+
6+
GOVER := $(shell go env GOVERSION)
7+
GOMINOR := $(shell bash -c "cut -f2 -d. <<< $(GOVER)")
8+
9+
define execute-if-go-122
10+
@{ \
11+
if [[ 22 -le $(GOMINOR) ]]; then \
12+
$1; \
13+
else \
14+
echo -e "$(YELLOW)Skipping task as you're running Go v1.$(GOMINOR).x which is < Go 1.22, which this module requires$(RESET)"; \
15+
fi \
16+
}
17+
endef
18+
19+
lint:
20+
$(call execute-if-go-122,$(GOBIN)/golangci-lint run ./...)
21+
22+
lint-ci:
23+
24+
$(call execute-if-go-122,$(GOBIN)/golangci-lint run ./... --out-format=github-actions --timeout=5m)
25+
26+
generate:
27+
$(call execute-if-go-122,go generate ./...)
28+
29+
test:
30+
$(call execute-if-go-122,go test -cover ./...)
31+
32+
tidy:
33+
$(call execute-if-go-122,go mod tidy)
34+
35+
tidy-ci:
36+
$(call execute-if-go-122,tidied -verbose)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy