Administrator
Administrator
Published on 2024-09-30 / 1 Visits
0
0

基础

基础

开发注意事项

image

25个关键字

	break        default      func         interface    select
    case         defer        go           map          struct
    chan         else         goto         package      switch
    const        fallthrough  if           range        type
    continue     for          import       return       var

37个保留字

 Constants:    true  false  iota  nil

 Types:    int  int8  int16  int32  int64  
              uint  uint8  uint16  uint32  uint64  uintptr
              float32  float64  complex128  complex64
              bool  byte  rune  string  error

 Functions:   make  len  cap  new  append  copy  close  delete
                 complex  real  imag
                 panic  recover

可见性

  1. 声明在函数内部,是函数的本地值,类似private
  2. 声明在函数外部,是对当前包可见(包内所有.go文件都可见)的全局值,类似protect
  3. 声明在函数外部且首字母大写是所有包可见的全局值,类似public

四种声明方式

var(声明变量), const(声明常量), type(声明类型) ,func(声明函数)

编译与构建

目录

	src:源代码文件#
    pkg:包文件
    bin:相关bin文件

注释

image


Comment