HOME
  Security
   Software
    Hardware
  
FPGA
  CPU
   Android
    Raspberry Pi
  
nLite
  Xcode
   etc.
    ALL
  
LINK
BACK
 

2019/11/10

Raspberry Piで Googleの Go言語をインストールして動かす Raspberry Piで Googleの Go言語をインストールして動かす

(Raspberry Piで Googleの Go言語をインストールして動かす)

Tags: [Raspberry Pi], [電子工作], [セキュリティ]




● Raspberry Piで Googleの Go言語をインストールして動かす

Go is an open source programming language


Stable versions
go1.13.4.linux-armv6l.tar.gz
# Stable versions go1.13.4
wget https://dl.google.com/go/go1.13.4.linux-armv6l.tar.gz

sudo tar -C /usr/local -xvzf go1.13.4.linux-armv6l.tar.gz

cat /usr/local/go/VERSION
# go1.13.4

# .bashrc
export PATH=$PATH:/usr/local/go/bin

source .bashrc

go version
# go version go1.13.4 linux/arm

hello.go
package main

import "fmt"

func main() {
    fmt.Println("Hello, 世界")
}
# .goファイルをそのまま実行
go run hello.go
# Hello, 世界

# .goファイルを実行ファイルに変換して実行
go build hello.go
./hello
# Hello, 世界

ls -l hello*
# -rwxr-xr-x 1 pi pi 1880001 Nov 10 01:59 hello
# -rw-r--r-- 1 pi pi      78 Nov 10 01:59 hello.go

# 実行ファイルのサイズが 1.8MBも、、、ランライムライブラリがデカイ!!!


● Go言語の雑感

 ・ポインタが有る
 ・日本語文字列(ASCII文字以外)の操作が面倒(rune型 = Unicode code point、byte型 = UTF-8)
import "strings" strings パッケージ(内部で unicode/utf8パッケージを使用)
import "unicode/utf8" unicode/utf8 パッケージ



Tags: [Raspberry Pi], [電子工作], [セキュリティ]

●関連するコンテンツ(この記事を読んだ人は、次の記事も読んでいます)

Raspberry Piで Googleの Go言語 + Gin Webフレームワークをインストールして Webアプリを作る
Raspberry Piで Googleの Go言語 + Gin Webフレームワークをインストールして Webアプリを作る

  Raspberry Piで Googleの Go言語 + Gin Webフレームワークをインストールして Webアプリを作る

Raspberry Piで WebAPIモックサーバー JSON Serverを動かしてみるテスト
Raspberry Piで WebAPIモックサーバー JSON Serverを動かしてみるテスト

  Raspberry Piで APIモックサーバー JSON Serverを動かしてみるテスト

Raspberry Piで WebAPIモックサーバー Stubcellを動かしてみるテスト
Raspberry Piで WebAPIモックサーバー Stubcellを動かしてみるテスト

  Raspberry Piで APIモックサーバー Stubcellを動かしてみるテスト

Raspberry Piで WebAPIモックサーバー swagger-nodeを動かしてみるテスト
Raspberry Piで WebAPIモックサーバー swagger-nodeを動かしてみるテスト

  Raspberry Piで APIモックサーバー swagger-nodeを動かしてみるテスト

Raspberry Piに PHP 7.2を公式リポジトリからサクッと apt-getでインストールする方法
Raspberry Piに PHP 7.2を公式リポジトリからサクッと apt-getでインストールする方法

  PHP7.2をラズパイ公式リポジトリから Raspberry Piに簡単にインストールする方法




[HOME] | [BACK]
リンクフリー(連絡不要、ただしトップページ以外は Web構成の変更で移動する場合があります)
Copyright (c) 2019 FREE WING,Y.Sakamoto
Powered by 猫屋敷工房 & HTML Generator

http://www.neko.ne.jp/~freewing/raspberry_pi/raspberry_pi_go_language/