Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Commit 03f3d35

Browse files
committed
Initial commit
0 parents  commit 03f3d35

Some content is hidden

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

52 files changed

+2854
-0
lines changed

.bazelrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build --stamp --workspace_status_command=./bazel/scripts/stamp.bash
2+
test --test_output=all

.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.idea
2+
.vscode
3+
bazel-*
4+
5+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
6+
*.o
7+
*.a
8+
*.so
9+
10+
# Folders
11+
_obj
12+
_test
13+
14+
# Architecture specific extensions/prefixes
15+
*.[568vq]
16+
[568vq].out
17+
18+
*.cgo1.go
19+
*.cgo2.c
20+
_cgo_defun.c
21+
_cgo_gotypes.go
22+
_cgo_export.*
23+
24+
_testmain.go
25+
26+
*.exe
27+
*.test
28+
*.prof
29+
30+
app
31+
debug

.gitpod.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ports:
2+
# - port: 8080
3+
# onOpen: open-preview
4+
5+
checkoutLocation: "go/src/github.com/jrbeverly/golang-gin-consignment"
6+
workspaceLocation: "go/src/github.com/jrbeverly/golang-gin-consignment"
7+
8+
image:
9+
file: .gitpod/Dockerfile
10+
11+
# tasks:
12+
# - init: >
13+
# go build -o app
14+
# command: >
15+
# ./app
16+
17+
vscode:
18+
extensions:
19+
- golang.go
20+
- ms-azuretools.vscode-docker
21+
- bazelbuild.vscode-bazel
22+
- hashicorp.terraform

.gitpod/Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM gitpod/workspace-full
2+
USER root
3+
4+
RUN mkdir $HOME/bin
5+
RUN npm install -g @bazel/bazelisk
6+
RUN npm install -g @bazel/ibazel
7+
8+
ARG BAZEL_BUILDTOOLS_URL="https://github.com/bazelbuild/buildtools/releases/download"
9+
RUN curl -sSL "${BAZEL_BUILDTOOLS_URL}/5.1.0/buildozer-linux-amd64" > /usr/local/bin/buildozer && \
10+
curl -sSL "${BAZEL_BUILDTOOLS_URL}/5.1.0/buildifier-linux-amd64" > /usr/local/bin/buildifier && \
11+
chmod +x /usr/local/bin/buildozer && \
12+
chmod +x /usr/local/bin/buildifier
13+
14+
USER gitpod

.vscode/launch.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "debug",
12+
"program": "${workspaceFolder}"
13+
}
14+
]
15+
}

BUILD.bazel

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
load("@bazel_gazelle//:def.bzl", "gazelle")
2+
3+
# gazelle:prefix github.com/jrbeverly/cobra-cmd-with-docs
4+
gazelle(name = "gazelle")
5+
6+
gazelle(
7+
name = "gazelle-update-repos",
8+
args = [
9+
"-from_file=go.mod",
10+
"-to_macro=bazel/go/deps.bzl%go_dependencies",
11+
"-prune",
12+
],
13+
command = "update-repos",
14+
)
15+
16+
filegroup(
17+
name = "templates",
18+
srcs = glob(["templates/*"]),
19+
visibility = ["//visibility:public"],
20+
)

Makefile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.DEFAULT_GOAL:=all
2+
SHELL:=/bin/bash
3+
4+
.PHONY: run
5+
run: ## Invoke the executable
6+
bazel run //cmd/cobradocs -- server
7+
# -- $(PWD)/cmd/golang-jsonschema/toolchain.yaml $(PWD)/cmd/golang-jsonschema/toolchain.json
8+
9+
.PHONY: all build test generate
10+
all: build test ## Build & test all targets
11+
12+
build: ## Build all targets
13+
bazel build //...
14+
15+
test: ## Test all targets
16+
bazel test //...
17+
18+
generate: ## Generate the models
19+
bazel run //:gazelle
20+
bazel run //:gazelle-update-repos
21+
bazel run //:gazelle
22+
23+
.PHONY: help
24+
help: ## Display this help message
25+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Golang Gin & Gitpod
2+
3+
Fiddling with the Dev experience of Golang gin within Gitpod
4+
5+
Based on [gitpod-io/go-gin-app](https://github.com/gitpod-io/go-gin-app)
6+
7+
## Notes
8+
9+
- Prefer the pattern of combining this with cobra
10+
- Server rendered HTML is pretty straightforward
11+
- Returning simple JSON pretty straightforward
12+
- Can be combined with GRPC + Proto
13+
- What about swagger for generating the modules?
14+
- Considerations about how to organize the elements (cli, server, routes, models, database, etc)
15+
- What about logging for this?
16+
- Gitpod has occassionally issues with the import of gin
17+
- References for things like `templates/` at the top level is nice
18+
- Log while running is excellent
19+
20+
Overall positive.

WORKSPACE

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
workspace(name = "golang-gin-consignment")
2+
3+
load("//:bazel/rules/deps.bzl", "bazel_dependencies")
4+
5+
bazel_dependencies()
6+
7+
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
8+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
9+
load("//:bazel/go/deps.bzl", "BAZEL_GOLANG_VERSION", "go_dependencies")
10+
11+
# gazelle:repository_macro bazel/go/deps.bzl%go_dependencies
12+
go_dependencies()
13+
14+
go_rules_dependencies()
15+
16+
go_register_toolchains(version = BAZEL_GOLANG_VERSION)
17+
18+
gazelle_dependencies()
19+
20+
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
21+
22+
rules_pkg_dependencies()
23+
24+
load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories")
25+
26+
container_repositories()
27+
28+
load("@io_bazel_rules_docker//go:image.bzl", _go_image_repos = "repositories")
29+
30+
_go_image_repos()

bazel/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)