Even if opts.OkCodes is nil, len(nil) == 0, so you can simplify this to just:

if len(opts.OkCodes) > 0 {