Skip to content

Playground fails with a 403 error when wanting to execute Go code with comments #506

@joseluisq

Description

@joseluisq

Describe the bug
When attempting to execute the code below, the Playground returned a 403 error then shown in the Output panel.
The funny part is that it seems a simple comment in the snippet breaks the playground, and attempting to click on Share also fails.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the playground and enter this snippet
package main

import (
	"fmt"
	"sync"
	"time"
)

func main() {
	doneChan := make(chan struct{})
	var wg sync.WaitGroup

	wg.Add(1)
	go func() {
		defer wg.Done()
		time.Sleep(2 * time.Second)
		fmt.Println("Task from WaitGroup done")
	}()

	go func() {
		time.Sleep(1 * time.Second)
		fmt.Println("Task from channel done")
		doneChan <- struct{}{}
	}()
	// This simple comment breaks the playground (remove it and it will work)
	wgDoneChan := make(chan struct{})
	go func() {
		wg.Wait()
		close(wgDoneChan)
	}()

	select {
	case <-doneChan:
		fmt.Println("Received done signal from channel")
	case <-wgDoneChan:
		fmt.Println("All WaitGroup tasks done")
	}
}
  1. Click on 'Run'
  2. Then you will get an Error 403 ... in the Output panel.

Expected behavior

Code executed without backend issues.

Screenshots

Run
Image

Share
Image

Desktop (please complete the following information):

  • OS: macos
  • Browser Chrome 138.0.7204.101
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

awaiting-feedbackRequires feedback from one or other usersbugSomething isn't workinginfra

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions