Guava Preconditions allow to check method parameters in Java easily.
public void doUsefulThings(Something s, int x, int position) {
checkNotNull(s);
checkArgument(x >= 0, "Argument was %s but expected nonnegative", x);
checkElementIndex(position, someList.size());
// ...
}
These check methods raise exceptions if the conditions are not met.
Go has no exceptions but indicates errors with return values. So I wonder how an idiomatic Go version of the above code would look like.