...
1#!/bin/sh -eu
2
3builtins='[a-z0-9]+|struct{}'
4pkgs='k8s\.io/api/.*|k8s\.io/apimachinery/.*|github\.com/openshift/api/.*'
5
6# Check that types used in OpenShift API are designed to be used in API.
7#
8# For example, time.Duration does not implement encoding/json.Unmarshaler, so
9# it is encoded as integer nanoseconds, which can be inconvenient. There is the
10# wrapper k8s.io/apimachinery/pkg/apis/meta/v1.Duration that marshals into
11# strings, and it should be preferred to time.Duration.
12#
13# The whitelisted types are
14#
15# * go built-in types
16# * types that are defined in this package (FooSpec, FooStatus, etc.)
17# * types from k8s.io API packages
18#
19go run ./hack/typelinter \
20 -whitelist="^(?:\[]|\*|map\[string])*(?:$builtins|(?:$pkgs)\.[A-Za-z0-9]+)\$" \
21 -excluded=github.com/openshift/api/build/v1.BuildStatus:Duration \
22 -excluded=github.com/openshift/api/image/dockerpre012.Config:ExposedPorts \
23 -excluded=github.com/openshift/api/image/dockerpre012.ImagePre012:Created \
24 -excluded=github.com/openshift/api/imageregistry/v1.ImagePrunerSpec:KeepYoungerThan \
25 ./...
View as plain text