search

Linux does not support go language

May 29, 2023 pm 10:25 PM
linuxgo language

Linux supports go language because go language can be cross-platform. Due to its modular design and modularity, that is, the code is compiled and converted into the smallest possible binary form, therefore, the Go language does not require dependencies and supports platform independence; its code can be run on any platform (Windows, Linux, Mac OS etc.) and can be compiled on any server and application.

Go is a procedural programming language that can be used for fast machine code compilation. It is a statically typed compiled language. It provides a concurrency mechanism that makes it easy to develop multi-core and networked machine-level programs. It is a fast, dynamically typed and interpreted language; it provides support for interfaces and type embedding.

Linux supports go language because go language can be cross-platform.

Go language, like Java language, supports platform independence. It requires no dependencies due to its modular design and the compilation and conversion of code into a minimized binary form. Its code can be compiled on any platform (Windows, Linux, Mac OS, etc.) and can be compiled on any server and application.

Go language code can be directly compiled into binary executable files without using a virtual machine. The Go language has an independent linker and does not need to rely on the compiler and linker provided by any operating system. Therefore, the compiled binary executable file can run in almost any system environment.

Building a Go language development environment on Linux

1. Install the Go language development package

You can view it on the Go language official website Looking at the installation package, the development package has two versions: 32-bit and 64-bit. You need to choose different versions according to the situation of the reader's computer.

Linux does not support go language

Copy the download link of the Go language development package. Then, use the cd command in the terminal to enter the directory where you store the installation package (the /usr/local/ directory is used here, readers can also use other directories).

root@ububtu:~# cd /usr/local/
root@ububtu:/usr/local#

Use the wget command to download the Go language development package, as shown below.

<pre class='brush:php;toolbar:false;'>root@ububtu:/usr/local# wget https://dl.google.com/go/go1.13.4.linux-amd64.tar.gz --2019-11-06 10:47:23-- https://dl.google.com/go/go1.13.4.linux-amd64.tar.gz 正在解析主机 dl.google.com (dl.google.com)... 203.208.39.196, 203.208.39.193, 203.208.39.200, ... 正在连接 dl.google.com (dl.google.com)|203.208.39.196|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度: 120054682 (114M) [application/octet-stream] 正在保存至: “go1.13.4.linux-amd64.tar.gz” go1.13.4.linux 43% 49.44M 3.56MB/s 剩余 16s ^go1.13.4.linux 100% 114.49M 4.73MB/s 用时 31s 2019-11-06 10:47:56 (3.67 MB/s) - 已保存 “go1.13.4.linux-amd64.tar.gz” [120054682/120054682])</pre><p>Use the tar command to decompress the Go language development package you just downloaded. </p><pre class='brush:php;toolbar:false;'>root@ububtu:/usr/local# tar -C /usr/local -xzf go1.13.4.linux-amd64.tar.gz</pre><p>After successful decompression, a go directory will be added in the current directory. At this point, our Go language development kit has been installed. Use the cd command to enter the directory, and then execute bin/ You can use the go version command to view the current Go language version. </p><pre class='brush:php;toolbar:false;'>root@ububtu:/usr/local/go# bin/go version go version go1.13.4 linux/amd64</pre><p><strong>Configure environment variables</strong></p> <p>We need to configure 2 environment variables, GOROOT and PATH. </p> <ul class=" list-paddingleft-2"> <li><p>The value of GOROOT should be the current installation directory of the Go language: <code>export GOROOT=/usr/local/go

  • PATH In order to facilitate the use of Go language commands and Go program executable files, you need to append its value: export PATH=$PATH:$GOROOT/bin:$GOBIN

  • In order to facilitate future use, these environment variables need to be added to the profile file (~/.bash_profile or /etc/profile). If it is used by a single user, the environment variable can be added to the bash_profile file in the home directory. If used by multiple users, it needs to be added to the /etc/profile file. It is recommended to set environment variables in the /etc/profile file

    Use the vi /etc/profile command to open the profile file and add the environment variables to the end of the file.

    Linux does not support go language

    After the addition is completed, use the :wq command to save and exit.

    Then, use the source /etc/profile command to make the configuration file take effect. Now you can use Go language commands in any directory.

    Verify installation

    Use the terminal in any directory to execute the go env command. The following output shows that the Go language development package has been successfully installed.

    <pre class='brush:php;toolbar:false;'>root@ububtu:~$ go env GO111MODULE=&quot;&quot; GOARCH=&quot;amd64&quot; GOBIN=&quot;&quot; GOCACHE=&quot;/home/feng/.cache/go-build&quot; GOENV=&quot;/home/feng/.config/go/env&quot; GOEXE=&quot;&quot; GOFLAGS=&quot;&quot; GOHOSTARCH=&quot;amd64&quot; GOHOSTOS=&quot;linux&quot; GONOPROXY=&quot;&quot; GONOSUMDB=&quot;&quot; GOOS=&quot;linux&quot; GOPATH=&quot;/home/feng/go&quot; GOPRIVATE=&quot;&quot; GOPROXY=&quot;https://proxy.golang.org,direct&quot; GOROOT=&quot;/usr/local/go&quot; GOSUMDB=&quot;sum.golang.org&quot; GOTMPDIR=&quot;&quot; . . .</pre><p> Tip: Only partial results are shown above. <br></p>

    The above is the detailed content of Linux does not support go language. For more information, please follow other related articles on the PHP Chinese website!

    Statement
    This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete
    The Building Blocks of Linux: Key Components ExplainedThe Building Blocks of Linux: Key Components ExplainedApr 30, 2025 am 12:26 AM

    The core components of the Linux system include the kernel, file system, and user space. 1. The kernel manages hardware resources and provides basic services. 2. The file system is responsible for data storage and organization. 3. Run user programs and services in the user space.

    Using Maintenance Mode: Troubleshooting and Repairing LinuxUsing Maintenance Mode: Troubleshooting and Repairing LinuxApr 29, 2025 am 12:28 AM

    Maintenance mode is a special operating level entered in Linux systems through single-user mode or rescue mode, and is used for system maintenance and repair. 1. Enter maintenance mode and use the command "sudosystemctlisolaterscue.target". 2. In maintenance mode, you can check and repair the file system and use the command "fsck/dev/sda1". 3. Advanced usage includes resetting the root user password, mounting the file system in read and write mode and editing the password file.

    Linux Maintenance Mode: Understanding the PurposeLinux Maintenance Mode: Understanding the PurposeApr 28, 2025 am 12:01 AM

    Maintenance mode is used for system maintenance and repair, allowing administrators to work in a simplified environment. 1. System Repair: Repair corrupt file system and boot loader. 2. Password reset: reset the root user password. 3. Package management: Install, update or delete software packages. By modifying the GRUB configuration or entering maintenance mode with specific keys, you can safely exit after performing maintenance tasks.

    Linux Operations: Networking and Network ConfigurationLinux Operations: Networking and Network ConfigurationApr 27, 2025 am 12:09 AM

    Linux network configuration can be completed through the following steps: 1. Configure the network interface, use the ip command to temporarily set or edit the configuration file persistence settings. 2. Set up a static IP, suitable for devices that require a fixed IP. 3. Manage the firewall and use the iptables or firewalld tools to control network traffic.

    Maintenance Mode in Linux: A System Administrator's GuideMaintenance Mode in Linux: A System Administrator's GuideApr 26, 2025 am 12:20 AM

    Maintenance mode plays a key role in Linux system management, helping to repair, upgrade and configuration changes. 1. Enter maintenance mode. You can select it through the GRUB menu or use the command "sudosystemctlisolaterscue.target". 2. In maintenance mode, you can perform file system repair and system update operations. 3. Advanced usage includes tasks such as resetting the root password. 4. Common errors such as not being able to enter maintenance mode or mount the file system, can be fixed by checking the GRUB configuration and using the fsck command.

    Maintenance Mode in Linux: When and Why to Use ItMaintenance Mode in Linux: When and Why to Use ItApr 25, 2025 am 12:15 AM

    The timing and reasons for using Linux maintenance mode: 1) When the system starts up, 2) When performing major system updates or upgrades, 3) When performing file system maintenance. Maintenance mode provides a safe and controlled environment, ensuring operational safety and efficiency, reducing impact on users, and enhancing system security.

    Linux: Essential Commands and OperationsLinux: Essential Commands and OperationsApr 24, 2025 am 12:20 AM

    Indispensable commands in Linux include: 1.ls: list directory contents; 2.cd: change working directory; 3.mkdir: create a new directory; 4.rm: delete file or directory; 5.cp: copy file or directory; 6.mv: move or rename file or directory. These commands help users manage files and systems efficiently by interacting with the kernel.

    Linux Operations: Managing Files, Directories, and PermissionsLinux Operations: Managing Files, Directories, and PermissionsApr 23, 2025 am 12:19 AM

    In Linux, file and directory management uses ls, cd, mkdir, rm, cp, mv commands, and permission management uses chmod, chown, and chgrp commands. 1. File and directory management commands such as ls-l list detailed information, mkdir-p recursively create directories. 2. Permission management commands such as chmod755file set file permissions, chownuserfile changes file owner, and chgrpgroupfile changes file group. These commands are based on file system structure and user and group systems, and operate and control through system calls and metadata.

    See all articles

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    SublimeText3 Linux new version

    SublimeText3 Linux new version

    SublimeText3 Linux latest version

    VSCode Windows 64-bit Download

    VSCode Windows 64-bit Download

    A free and powerful IDE editor launched by Microsoft

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    Dreamweaver Mac version

    Dreamweaver Mac version

    Visual web development tools

    WebStorm Mac version

    WebStorm Mac version

    Useful JavaScript development tools