• Go语言从入门到放弃(四)


    前言

    有段时间没摸Go语言了,最近B站的Go语言泄露挺火的.

    还差的很远呐

    学无止境

    本章主要介绍一些零碎的小知识点

    变更记录

    # 19.4.30  起笔

    # 19.4.30  增加代码打包步骤

    正文

    go代码打包

    与Python不同,go语言在生产环境中是需要打包代码的

    比如写一个最简单的helloworld

    package main  // 声明 main 包, 表明当前是个可执行程序
    
    import "fmt"  // 导入内置的fmt包
    
    func main()  {  // main函数是程序执行的入口
        fmt.Println("hello world")
    }

    然后我们在这个go文件所在位置使用命令行输入

    go build

    然后在该文件的同级会出现一个 hello.exe 文件

    执行该exe会出现代码写的效果

    为什么会叫 hello.exe 呢?是因为在src中我们代码存放的文件夹叫 hello

    我们可以生成后重命名为想要的名字

    也可以在生成时指定新名字

    go build -o test1.exe
  • 相关阅读:
    SpringMVC扩展
    反射机制
    python day9
    python day8
    python day7
    python day6
    python day4
    python day3
    python day2
    python day1
  • 原文地址:https://www.cnblogs.com/chnmig/p/10795958.html
Copyright © 2020-2023  润新知