k8s.io/kubernetes@v1.29.3/test/typecheck/testdata/bad/bad.go (about) 1 /* 2 Copyright 2020 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package main 18 19 import "fmt" 20 21 var i int = int16(0) 22 var pi *int = new(int16) 23 var i16 int16 = int(0) 24 var pi16 *int16 = new(int) 25 var i32 int32 = int64(0) 26 var pi32 *int32 = new(int64) 27 var i64 int64 = int32(0) 28 var pi64 *int64 = new(int32) 29 30 var f32 float32 = float64(0.0) 31 var pf32 *float32 = new(float64) 32 var f64 float64 = float32(0.0) 33 var pf64 *float64 = new(float32) 34 35 var str string = false 36 var pstr *string = new(bool) 37 38 type struc struct { 39 i int 40 f float64 41 s string 42 } 43 44 var stru struc = &struc{} 45 var pstru *struc = struc{} 46 47 var sli []int = map[string]int{"zero": 0} 48 var ma map[string]int = []int{0} 49 50 func main() { 51 fmt.Println("hello, world!") 52 }