2019年4月26日金曜日

golang for Raspberry pi

1)golangをダウンロードする。
root@rasp-master:~# wget https://golang.org/dl/go1.10.1.linux-armv6l.tar.gz

2)インストールを行う。
root@rasp-master:~# sudo tar -C /usr/local -xzf go1.10.1.linux-armv6l.tar.gz

3)導入状態を確認する
root@rasp-master:~# ls -l /usr/local/go
===========================================
合計 188
-rw-r--r--  1 root root 47028  3月 29  2018 AUTHORS
-rw-r--r--  1 root root  1339  3月 29  2018 CONTRIBUTING.md
-rw-r--r--  1 root root 61940  3月 29  2018 CONTRIBUTORS
-rw-r--r--  1 root root  1479  3月 29  2018 LICENSE
-rw-r--r--  1 root root  1303  3月 29  2018 PATENTS
-rw-r--r--  1 root root  1555  3月 29  2018 README.md
-rw-r--r--  1 root root     8  3月 29  2018 VERSION
drwxr-xr-x  2 root root  4096  3月 29  2018 api
drwxr-xr-x  2 root root  4096  3月 29  2018 bin
drwxr-xr-x  4 root root  4096  3月 29  2018 blog
drwxr-xr-x  8 root root  4096  3月 29  2018 doc
-rw-r--r--  1 root root  5686  3月 29  2018 favicon.ico
drwxr-xr-x  3 root root  4096  3月 29  2018 lib
drwxr-xr-x 14 root root  4096  3月 29  2018 misc
drwxr-xr-x  5 root root  4096  3月 29  2018 pkg
-rw-r--r--  1 root root    26  3月 29  2018 robots.txt
drwxr-xr-x 46 root root  4096  3月 29  2018 src
drwxr-xr-x 20 root root 12288  3月 29  2018 test
=========================================

4)バージョンの確認をする。
root@rasp-master:~# cat /usr/local/go/VERSION

go1.10.1root@rasp-master:~# 


5)パスを追加する。

# vi ~/.bashrc
======================================
# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'


export PATH=$PATH:/usr/local/go/bin
===================================================


6)パスの有効化をする。
# source .bashrc


7)goファイルを実行させる
例:go run [ファイル名]
# go run requestinfo.go  <---ファイル名





0 件のコメント:

コメントを投稿

メモ

 find フォルダー名 -type f -exec sed -i 's/\/FKP/\/WEB\/FKP/g' {} +