Ask Question

The Go Playground is a web service that runs on golang.org's servers. The service receives a Go program, compiles, links, and runs the program inside a sandbox, then returns the output.

23 questions

-1votes1answer31views

Go playground url validate

I am sending a request which has a URL and Content in the body. The validations are such that either URL or epicentre is mandatory. The program is erroring when the URL is empty as url validate on an ... user avatar Daffodil

  • 29
1vote2answers294views

Backspace character does not work in the Go playground

I am new to Go. Just learnt the various uses of fmt.Println(). I tried the following stuff in the official playground but got a pretty unexpected output. Please explain where I have gone wrong in my ... user avatar justanotherguy

  • 313
1vote1answer36views

cmd.StdoutPipe example in go pkg docs does not run in playground

cmd.StdoutPipe example at go documentation: does not run in playground. Error: fatal error: all goroutines are ... user avatar Abhay Pratap Singh

  • 101
2votes0answers306views

How to perform the parameter type check in golang gin using validator?

I have a Validator struct like this type UploadFileFormValidator struct { File []*multipart.FileHeader `form:"File" binding:"required,min=1"` InputKey string ... user avatar JY F

  • 29
2votes1answer79views

Will the code be deleted when I close vscode-go:playground?

I accidentally clicked on "go run on go playground" when I was developing in vscode. Since it is a company code, I would like to know if the code will be deleted. user avatar 5waker

  • 23
4votes1answer107views

Closing stop channel does not stop goroutines

INTRODUCTION: I am just starting to learn the Go language and have reached the lesson about concurrency. I have invented a small task for myself to try to implement what I have learned about closing ... user avatar AlwaysLearningNewStuff

  • 2,871
5votes2answers3kviews

How can I validate a struct datatype with a custom validator?

I am using go-playground/validator/v10 to validate some input and have some trouble with custom validation tags and functions. The problem is that the function is not called when one of the struct ... user avatar FewWords

  • 505
0votes1answer921views

net/http doesn't work in the Go Playground

Can someone please explain what am I doing wrong. So basically I'am trying to make a simple HTTP GET request. I copied code from When I'm running it locally ... user avatar Vor

  • 30.6k
0votes1answer814views

validating array of structs using goplayground validator library

How can I validate a slice of structs using validator framework? For example, in the following type definitions, I want to validate each element in the field Puppies. type User struct { FirstName ... user avatar Rajesh

  • 11
1vote1answer995views

playground - timeout running go build

When I try to run code snippet on playground (snippet) , I get an error: timeout running go build go: finding module for package go: downloading v1.7.1 go:... user avatar kozmo

  • 3,107
4votes2answers2kviews

go2go.playground - expected type, found 'type' (and 1 more errors)

I try to run examples from the design draft (The Next Step for Generics) on go2go.playground type Pair(type T) struct { f1, f2 T } , but get an error prog.go2:14:11: expected type, found 'type' (and ... user avatar kozmo

  • 3,107
5votes1answer472views

Exiting forever loop using channels - issues with Go Playground

I am trying to implement a simple logic where a Producer sends data to a channel ch with an forever for loop and a Consumer reads from the channel ch. The Producer stops producing and exit the forever ... user avatar Picci

  • 15k
0votes1answer797views

How to chain validations together using Golang go-playground/validator?

I am using for a REST API server. I am using the same struct for different endpoint with different validation requirement. For example, /users/login requires ... user avatar huggie

  • 16.5k
8votes3answers14kviews

Package name containing hyphen

I am having some trouble understanding that why my code complains when I have hyphen in package. e.g. if I have a package name foo-bar and I declare that package name package foo-bar foo-bar/config.... user avatar Aman Chourasiya

  • 788
3votes0answers814views

Why does Go test with blocked channel not reporting deadlock

I met a strange issue when doing test with channels. In a normal main function, the following code will report the deadlock error. package main import ( "fmt" ) func main() { c := make(... user avatar James Ni

  • 125

153050per page

1 2