conventions.io

Tech Challenge

2026-07-19

🦫

Daily Tech Challenge

Go

medium
Question 1 of 5

What does this Go program print?

Example
package main

import (
	"errors"
	"fmt"
)

type ValidationError struct{ Field string }

func (e *ValidationError) Error() string { return "invalid " + e.Field }

func main() {
	err := fmt.Errorf("request failed: %w", &ValidationError{Field: "email"})
	var ve *ValidationError
	if errors.As(err, &ve) {
		fmt.Println("field:", ve.Field)
	} else {
		fmt.Println("no match")
	}
}

Sunday, July 19, 2026 · A new challenge drops every day