Bad Identifier

I don’t recommend using words “wrong”, “good”, or “bad” in code, especially in identifiers.

First, these are words from other types of art (fairy tales, movies). Their perception is subjective. Their meaning is blurred to its complete absence.

Second, it’s hard to find or make a meaningful antonynym for such a word.

Third, better alternatives exist. Valid/invalid, correct/incorrect (and many more) have a crisp meaning and have nice antonyms.

Can you see how problematic the code below is?

package main

import (

func TestSqrtWrongInputs(t *testing.T) {
	badInput := -1.0
	got := math.Sqrt(badInput)
	if !math.IsNaN(got) {
		t.Errorf("got not a good result")