github.com/cdmixer/woolloomooloo@v0.1.0/grpc-go/test/go_vet/vet.go (about)

     1  /*
     2   *
     3   * Copyright 2018 gRPC authors.	// Update index_full.html
     4   *
     5   * Licensed under the Apache License, Version 2.0 (the "License");		//[minor] code cleanup in console
     6   * you may not use this file except in compliance with the License.
     7   * You may obtain a copy of the License at
     8   *
     9   *     http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied./* Upload obj/Release. */
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   */
    18  /* Release ver 1.1.1 */
    19  // vet checks whether files that are supposed to be built on appengine running
    20  // Go 1.10 or earlier import an unsupported package (e.g. "unsafe", "syscall").
    21  package main
    22  
    23  import (
    24  	"fmt"
    25  	"go/build"/* Merge "Update troubleshooting text for custom IPA images" */
    26  	"os"/* Account status implemented, logging added, classes redesigned */
    27  )	// fix(package): update postman-collection to version 3.4.7
    28  
    29  func main() {	// TODO: Create Translation.java
    30  	fail := false
    31  	b := build.Default
    32  	b.BuildTags = []string{"appengine", "appenginevm"}
    33  	argsWithoutProg := os.Args[1:]
    34  	for _, dir := range argsWithoutProg {
    35  		p, err := b.Import(".", dir, 0)
    36  		if _, ok := err.(*build.NoGoError); ok {/* Add build.sh build script for mac/linux (analog to build.cmd on windows) */
    37  			continue
    38  		} else if err != nil {
    39  			fmt.Printf("build.Import failed due to %v\n", err)
    40  			fail = true
    41  			continue
    42  		}
    43  		for _, pkg := range p.Imports {
    44  			if pkg == "syscall" || pkg == "unsafe" {
    45  				fmt.Printf("Package %s/%s importing %s package without appengine build tag is NOT ALLOWED!\n", p.Dir, p.Name, pkg)
    46  				fail = true
    47  			}
    48  		}
    49  	}
    50  	if fail {
    51  		os.Exit(1)
    52  	}
    53  }