Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 07:32
    seifchen commented #3384
  • Nov 27 17:41
    seal opened #3417
  • Nov 27 06:38
    MmToon commented #3416
  • Nov 27 05:59
    MmToon opened #3416
  • Nov 27 04:23
    rushairer commented #2704
  • Nov 26 13:28
    nishyt commented #3384
  • Nov 26 13:22
    nishyt commented #3384
  • Nov 26 12:03
    jarrodhroberson commented #1123
  • Nov 26 05:01
    zeek0x opened #3415
  • Nov 25 18:12
    ajmeese7 closed #3354
  • Nov 25 18:12
    ajmeese7 commented #3354
  • Nov 25 13:37
    Cookiery commented #3350
  • Nov 25 03:20
    Cookiery commented #3354
  • Nov 25 02:18
    ajmeese7 commented #3354
  • Nov 24 12:32
    therox commented #3350
  • Nov 24 09:54
    Cookiery commented #3354
  • Nov 24 06:18
    Cookiery commented #3369
  • Nov 24 05:53
    lcl1024 commented #3369
  • Nov 24 05:14
    Cookiery opened #3414
  • Nov 24 04:47
    Cookiery commented #3369
Gergely Brautigam
Gaia is using Vue so that should help you out a lot :)
can anyone forward me to any channel specific to docker content trust. Notary server!
I am doing a POC and facing issues
src/github.com/go-sql-driver/mysql/driver.go undefined: driver.connector
go version
go1.15 linux/amd64
any help is appreciated
my manager is killing me 🤪🤪🤪
I found that it was possible with go version higher than 1.10 and looking at the v 1.15 it should be supported right?
th m
Assume we have a recursive function with a os.File::Close() as defer invocation, Could it be tail-recursive?
Muhammad Ahsan Izhar
hello, i am new to Go world I am trying to shift some code base from NodeJS but results are different. why...
check this
happy air
Hi, please I need help. I have assets in vfsgen and using router.StaticFS(). That works well. But I would need for each request path ending with "/" (directory) return "/index.html" from vfs. Any idea please?
I found it out. Solution is router.NoRoute() + c.DataFromReader()
Iam coming
Hi everyone!
I am very new developer and faced with such a problem while installing Gin on Ubuntu
/go/src$ go get -u github.com/gin-gonic/gin
package github.com/gin-gonic/gin: directory "/home/user/go/src/github.com/gin-gonic/gin" is not using a known version control system
Maybe someone knows the solution?
Have you had git installed on your machine ? @RaminCH
It's strange to have such issues.
Hi @shyan1
Yup, Go_lev.2_RestAPI/Lec13$ git --version
git version 2.17.1
I even deleted and reinstalled
Also I installed Gin with: sudo apt-get install -y golang-github-gin-gonic-gin-dev
but it is very unconvenient, as no any packages linking, I write evry module manually and it is still not working
If it may clear I also get this kind of message:
/go/src$ go get github.com/gin-gonic/gin
package github.com/gin-gonic/gin: no Go files in /home/user/go/src/github.com/gin-gonic/gin
ahmar siddiqui
Hello good people 👋
is there any comprehensive guide that I can refer to regarding implementing testing in gin?
1 reply
Hi team, I am new in Go. I have an issuse with authorization api resources and scope.
For example, I have 2 apis (resources) like /users and /projects. /users has 2 subpath like /users/get and /users/delete, I just want to pre-check the permission of the access request, which comes with authorization info. For example, parsing the request and we got scope 'delete' and resource 'users', it can access /users/delete, but when access /users/get, it is denied. So my questtion is how can I define the scope and permission for endpoints in Go Gin? Thanks for reading!
1 reply
Hello everyone
I have a question
I want to write a program that, for example, has a timekeeping function and We also have an infinite loop function to receive instant input from the user and print it
And also is very important to both work together
Do not wait for the first function to end
Mohammad Fayaz
anyone running http2
Ryan W
Hi, is there an example of checking for mandatory request headers, and responding with a useful error back to the caller? I can easily catch this with ShouldBindHeader but I don’t get the reason as an err?

Hello everyone,
I'm getting context cancelled error inside my go routine below is my code.

func (service maintenanceHandler) CardHandler(ctx *gin.Context) {
    var requestBody models.DefaultTicket

    //perform some action.

    go doSomethingElse(requestBody.Priority,ctx)

I also tried with

func (service maintenanceHandler) CardHandler(ctx *gin.Context) {
    var requestBody models.DefaultTicket

    //perform some action.

    go doSomethingElse(requestBody.Priority,ctx.Copy())

In both the case I'm getting CONTEXT CANCELLED inside go routine method, can anyone please help me in this?

Mohammad Fayaz
Hi, how can I send the response and execute some code after sending the response to reduce response time
Stanisław Drozd
Hi, I'm trying to use BindJSON like this: https://paste.q3k.org/paste/wV2P1SdG#5gpfBdFCNygTgbmqRblICRZFbS5A7og5foV0uBdvuaz But my MessageDeleteQuery always becomes an empty struct and no error is caught
It fails only at req.code != msg.Code
ohhh, required, not requred :sweat:
Nah, that didn't change anything sadly
Stanisław Drozd
Got it, Needed to capitalize my field names
Hi to everybody! I'm implementig a web-app e I have a quetion! Is it possible to set a defaul value in a model?
Something like:
type MyModel struct {
key string `json:"key" bindind:"dafult=5"`
(sorry for my typos)
And another question: how can I enable CORS ?
Sorry: I'm newbie! And thank to anyone'll answer

How to use a type definition in another file with swaggo?
Using swaggo generate API document based on godoc syntax.
Source folder and files


For this definition:


    package post


    // Index godoc
    // @Summary Index Post
    // @Success 200 {array} []*Response
    // @Router /v1/posts [get]
    func Index(ctx *gin.Context) {

The Response is been defined in an another file but the same package.


    package post

    // Response  is post response body
    type Response struct {
        ID   int64  `json:"id"`
        Name string `json:"name"`

        CreatedAt string `json:"created_at"`
        UpdatedAt string `json:"updated_at"`

But when run swag init to generate swagger docs, it said:

    2021/01/29 09:39:56 Generate swagger docs....
    2021/01/29 09:39:56 Generate general API Info, search dir:./
    2021/01/29 09:39:56 ParseComment error in file application/post/controller.go :cannot find type definition:

When I move the Response struct to controller.go, it works.
How to import it with godoc or swaggo?

How to hide Models in gin-swagger?