Questions tagged [go-gin]
Gin is a HTTP web framework written in Go.
go-gin
914
questions
0
votes
0
answers
14
views
How do I handle a crash of a Golang (Gin) web server and recover with a new process?
I am in the process of writing a bunch of APIs. I am going to use Gin.
I will deploy behind a reverse proxy (I am forced to use Apache).
Like any process, I expect the Gin process to crash from time ...
2
votes
0
answers
45
views
GORM adding "AND column.id = 1", why?
Im having an issue with GORM on my GIN project.
Please help me if possible.
My issue is:
var class models.Classrom
var old_class models.Classrom
old_class.ClassID = "algorithm"
DB.Model(&...
1
vote
1
answer
34
views
Go/Gin/sqlc REST API endpoint that can update data to empty string
I am trying to understand marshalling of JSON in Go. I am a little bit confused because of Go's string nil value being "", which has a different semantic than a NULL.
While my code currently ...
1
vote
1
answer
66
views
How is maxLength/minLength translated by go-gin
I have a simple schema object SerialNumber defined as:
SerialNumber:
type: object
description: |
A serial number of an entity. This is a basic string but with length ...
1
vote
0
answers
47
views
How to Set Up Hot Reload for Gin Application Using Docker and Air in Dev Environment?
I'm working on a backend system using Gin and Docker, and I'm trying to set up two different environments: development and production. In the development environment, I want to use Air for hot ...
1
vote
0
answers
35
views
Go/Gin dlv debugger doesn't work with docker and vscode
I try to setup dev environment for Gin framework using docker and vscode. I can't figure why the breakpoint is visible in the debug console but seems the breakpoint has no effect. In docker I'm ...
2
votes
1
answer
23
views
gin router 404 on url patterns with :id parameter
I am getting a 404 error from a URL pattern with a quite simple parameter in it.
I am using gin-gonic with golang.
Here is my main programme. I've removed all other routing to isolate the problem.
...
-1
votes
0
answers
20
views
openapi-cli generator with openapi spec and gin code - enforcing required parameters and validation
I was looking at the pet store example in openapi-cli . The openapi/swagger spec has the "required" attribute for many fields, which implies that the parameter must be present in the request ...
0
votes
1
answer
64
views
Parsing path parameters dynamically from request url
I am working on a project using the fiber/v2 router, for a request mocking service. Now parameters passed via request body and query parameters are not an issue and handled easily. But here lies the ...
-1
votes
1
answer
44
views
Cannot use exported method that belongs to the package in Golang
I've got a package named services. This is the structure of the package:
services/
third_party/
discogs.go
discogsAPIStructs.go
artist_srv.go
auth_srv.go
record_srv.go
...
1
vote
0
answers
13
views
HTMLGlob template pattern matching with nested subdirectories
I am working on a golang project using gin and go templating.
My templates are in a structure like so:
C:.
├───components
├───display
....
I would like to add subdirectories to organise the templates,...
0
votes
0
answers
31
views
GORM many2many Association Replace not working as expected
I have a GO application using GIN and GORM. I want to create a Roles + Capabilities database. A role can have multiple capabilities and a capability can be in multiple roles. I created the following ...
1
vote
1
answer
64
views
Problem with Sending Data through Channel with Gin Context
I create a timeout middleware and I keep getting a warning that says 'Headers were already written. Wanted to override status code 504 with 500' whenever it times out. I want to avoid that warning by ...
1
vote
0
answers
44
views
How i can fetch session data?
I try to fetch some session data using a svelte frontend and i get a response status 401
This is the code that i use for the cors
router.Use(cors.New(cors.Config{
AllowOrigins: []string{&...
1
vote
0
answers
42
views
err.Translate(trans) only works if translator passed via param (go-playground/validator)
I'm trying to translate the validation errors message because I don't like the default error message. When I pass the trans variable via param from controllers to a helper (to handle validation error),...