Skip to content

Commit

Permalink
fix(version): go 1.22 and fixing builds
Browse files Browse the repository at this point in the history
  • Loading branch information
msfidelis committed May 17, 2024
1 parent 1872e80 commit fbb1333
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 178 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
unit-test:
strategy:
matrix:
go-version: [1.18.x, 1.19.x]
go-version: [1.22.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.15.x'
go-version: '1.22.x'

- uses: actions/checkout@v1

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.19 AS builder
FROM golang:1.22 AS builder

WORKDIR $GOPATH/src/chip

COPY . ./

RUN go get -u github.com/swaggo/swag/cmd/swag@v1.6.7
RUN go install github.com/swaggo/swag/cmd/swag@v1.7.8

RUN go get -u

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 AS builder
FROM golang:1.22 AS builder

# Install Air
RUN go get -u github.com/cosmtrek/air
Expand Down
6 changes: 3 additions & 3 deletions controllers/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ type Request struct {
}

type Response struct {
StatusCode int `json:"status_code"`
Body string `json:"body"`
Headers http.Header `json:"headers"`
StatusCode int `json:"status_code"`
Body string `json:"body"`
Headers map[string][]string `json:"headers"`
}

// Proxy godoc
Expand Down
95 changes: 34 additions & 61 deletions docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag

package docs

import (
"bytes"
"encoding/json"
"strings"
"text/template"

"github.com/alecthomas/template"
"github.com/swaggo/swag"
)

var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
Expand All @@ -40,7 +39,8 @@ var doc = `{
"tags": [
"Loadtest"
],
"summary": "Burn CPU for Loadtests and Auto Scaling Tests"
"summary": "Burn CPU for Loadtests and Auto Scaling Tests",
"responses": {}
}
},
"/burn/ram": {
Expand All @@ -51,7 +51,8 @@ var doc = `{
"tags": [
"Loadtest"
],
"summary": "Burn RAM for Loadtests and Auto Scaling Tests"
"summary": "Burn RAM for Loadtests and Auto Scaling Tests",
"responses": {}
}
},
"/healthcheck": {
Expand Down Expand Up @@ -350,25 +351,6 @@ var doc = `{
}
}
},
"/system": {
"get": {
"produces": [
"application/json"
],
"tags": [
"System"
],
"summary": "Return 500 Error Status Code",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/system.Capabilities"
}
}
}
}
},
"/system/environment": {
"get": {
"produces": [
Expand All @@ -377,7 +359,8 @@ var doc = `{
"tags": [
"System"
],
"summary": "Dump all environment variables in container"
"summary": "Dump all environment variables in container",
"responses": {}
}
},
"/version": {
Expand All @@ -388,7 +371,8 @@ var doc = `{
"tags": [
"Version"
],
"summary": "Return version for container"
"summary": "Return version for container",
"responses": {}
}
},
"/whoami": {
Expand Down Expand Up @@ -491,7 +475,13 @@ var doc = `{
"type": "string"
},
"headers": {
"type": "string"
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"status_code": {
"type": "integer"
Expand All @@ -513,21 +503,24 @@ var doc = `{
"type": "object",
"required": [
"body",
"cookies",
"headers",
"method",
"params",
"path"
],
"properties": {
"body": {
"type": "string"
},
"cookies": {
"description": "Cookies []*http.Cookie ` + "`" + `json:\"cookies\" binding:\"required\"` + "`" + `",
"type": "string"
},
"headers": {
"type": "string"
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"method": {
"type": "string"
Expand All @@ -540,33 +533,6 @@ var doc = `{
}
}
},
"system.Capabilities": {
"type": "object",
"required": [
"cpus",
"hostname",
"hypervisor",
"memory",
"os"
],
"properties": {
"cpus": {
"type": "integer"
},
"hostname": {
"type": "string"
},
"hypervisor": {
"type": "string"
},
"memory": {
"type": "integer"
},
"os": {
"type": "string"
}
}
},
"teapot.Teapot": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -608,6 +574,13 @@ func (s *s) ReadDoc() string {
a, _ := json.Marshal(v)
return string(a)
},
"escape": func(v interface{}) string {
// escape tabs
str := strings.Replace(v.(string), "\t", "\\t", -1)
// replace " with \", and if that results in \\", replace that with \\\"
str = strings.Replace(str, "\"", "\\\"", -1)
return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
},
}).Parse(doc)
if err != nil {
return doc
Expand All @@ -622,5 +595,5 @@ func (s *s) ReadDoc() string {
}

func init() {
swag.Register(swag.Name, &s{})
swag.Register("swagger", &s{})
}
79 changes: 23 additions & 56 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"tags": [
"Loadtest"
],
"summary": "Burn CPU for Loadtests and Auto Scaling Tests"
"summary": "Burn CPU for Loadtests and Auto Scaling Tests",
"responses": {}
}
},
"/burn/ram": {
Expand All @@ -35,7 +36,8 @@
"tags": [
"Loadtest"
],
"summary": "Burn RAM for Loadtests and Auto Scaling Tests"
"summary": "Burn RAM for Loadtests and Auto Scaling Tests",
"responses": {}
}
},
"/healthcheck": {
Expand Down Expand Up @@ -334,25 +336,6 @@
}
}
},
"/system": {
"get": {
"produces": [
"application/json"
],
"tags": [
"System"
],
"summary": "Return 500 Error Status Code",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/system.Capabilities"
}
}
}
}
},
"/system/environment": {
"get": {
"produces": [
Expand All @@ -361,7 +344,8 @@
"tags": [
"System"
],
"summary": "Dump all environment variables in container"
"summary": "Dump all environment variables in container",
"responses": {}
}
},
"/version": {
Expand All @@ -372,7 +356,8 @@
"tags": [
"Version"
],
"summary": "Return version for container"
"summary": "Return version for container",
"responses": {}
}
},
"/whoami": {
Expand Down Expand Up @@ -475,7 +460,13 @@
"type": "string"
},
"headers": {
"type": "string"
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"status_code": {
"type": "integer"
Expand All @@ -497,21 +488,24 @@
"type": "object",
"required": [
"body",
"cookies",
"headers",
"method",
"params",
"path"
],
"properties": {
"body": {
"type": "string"
},
"cookies": {
"description": "Cookies []*http.Cookie `json:\"cookies\" binding:\"required\"`",
"type": "string"
},
"headers": {
"type": "string"
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"method": {
"type": "string"
Expand All @@ -524,33 +518,6 @@
}
}
},
"system.Capabilities": {
"type": "object",
"required": [
"cpus",
"hostname",
"hypervisor",
"memory",
"os"
],
"properties": {
"cpus": {
"type": "integer"
},
"hostname": {
"type": "string"
},
"hypervisor": {
"type": "string"
},
"memory": {
"type": "integer"
},
"os": {
"type": "string"
}
}
},
"teapot.Teapot": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit fbb1333

Please sign in to comment.