Questions Tagged [Go-Playground]
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...
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.
Must Read
23
questions
-1
votes
1
answer
31
views
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 ...
1
vote
2
answers
294
views
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 ...
1
vote
1
answer
36
views
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 ...
2
votes
0
answers
306
views
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 ...
2
votes
1
answer
79
views
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.
4
votes
1
answer
107
views
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 ...
5
votes
2
answers
3k
views
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 ...
0
votes
1
answer
921
views
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 ...
0
votes
1
answer
814
views
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 ...
1
vote
1
answer
995
views
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:...
4
votes
2
answers
2k
views
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 ...
5
votes
1
answer
472
views
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 ...
0
votes
1
answer
797
views
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 ...
8
votes
3
answers
14k
views
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....
3
votes
0
answers
814
views
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(...