// CheckOpts carries out some global consistency checks on options.
//
// At the moment, these checks simply protect TargetPath() and SpecPath()
// functions. More checks may be added here.
CheckOpts carries out some global consistency checks on options.

At the moment, these checks simply protect TargetPath() and SpecPath()
functions. More checks may be added here.
// CheckOpts carries out some global consistency checks on options . // // At the moment these checks simply protect TargetPath () and SpecPath () // functions . More checks may be added here .
func (g *GenOpts) CheckOpts() error {
	if !filepath.IsAbs(g.Target) {
		if _, err := filepath.Abs(g.Target); err != nil {
			return fmt.Errorf("could not locate target %s: %v", g.Target, err)
		}
	}
	if filepath.IsAbs(g.ServerPackage) {
		return fmt.Errorf("you shouldn't specify an absolute path in --server-package: %s", g.ServerPackage)
	}
	if !filepath.IsAbs(g.Spec) && !strings.HasPrefix(g.Spec, "http://") && !strings.HasPrefix(g.Spec, "https://") {
		if _, err := filepath.Abs(g.Spec); err != nil {
			return fmt.Errorf("could not locate spec: %s", g.Spec)
		}
	}
	return nil
}
func ( g * GenOpts ) CheckOpts ( ) error { if ! filepath . IsAbs ( g . Target ) { if _ , err := filepath . Abs ( g . Target ) ; err != nil { return fmt . Errorf ( " " , g . Target , err ) } } if filepath . IsAbs ( g . ServerPackage ) { return fmt . Errorf ( " " , g . ServerPackage ) } if ! filepath . IsAbs ( g . Spec ) && ! strings . HasPrefix ( g . Spec , " " ) && ! strings . HasPrefix ( g . Spec , " " ) { if _ , err := filepath . Abs ( g . Spec ) ; err != nil { return fmt . Errorf ( " " , g . Spec ) } } return nil }
CheckOpts carries out some global consistency checks on options.
CheckOpts carries out some global consistency checks on options .