<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ecogrammer &#187; go</title>
	<atom:link href="http://ecogrammer.manno.jp/tag/go/feed/" rel="self" type="application/rss+xml" />
	<link>http://ecogrammer.manno.jp</link>
	<description>エコグラマー eco+programmer のブログ</description>
	<lastBuildDate>Sat, 04 Feb 2012 14:51:13 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tutorial for Go lang</title>
		<link>http://ecogrammer.manno.jp/2009/11/tutorial-for-go-lang/</link>
		<comments>http://ecogrammer.manno.jp/2009/11/tutorial-for-go-lang/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 17:18:25 +0000</pubDate>
		<dc:creator>manno</dc:creator>
				<category><![CDATA[memo]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tec]]></category>

		<guid isPermaLink="false">http://ecogrammer.manno.jp/?p=1334</guid>
		<description><![CDATA[<img src="http://ecogrammer.manno.jp/wp-content/uploads/2009/11/20091111-310x100.gif" alt="go lang" title="go lang" width="310" height="100" class="alignnone size-thumbnail wp-image-1316" />
備忘録。以下、<a href="http://golang.org/doc/go_tutorial.html#tmp_44">Echo</a> より

]]></description>
			<content:encoded><![CDATA[<p>備忘録。以下、<a href="http://golang.org/doc/go_tutorial.html#tmp_44">Echo</a> より<br />
&#8212;&#8211;</p>
<pre>
package main

import (
   "os";
   "flag"; // command line option parser
)

var omitNewline = flag.Bool("n", false, "don't print final newline")

const (
   Space = " ";
   Newline = "\n";
)

func main() {

   flag.Parse();   // Scans the arg list and set up flags

   var s string = "";

   for i := 0; i &lt; flag.NArg(); i++ {
      if i &gt; 0 {
         s += Space
      }
      s += flag.Arg(i)
   }

   if !*omitNewline {
      s += Newline    // 改行
   }
   os.Stdout.WriteString(s);   // 文字列出力

}
</pre>
<p>&#8212;&#8211;</p>
<p>コマンドラインで渡されたパラメータを出力するだけのプラグラム。<br />
主に使われているパッケージは以下の通り。日本語はかなり適当。</p>
<p>func Bool(name string, value bool, usage string) *bool<br />
Bool defines a bool flag with specified name, default value, and usage string. The return value is the address of a bool variable that stores the value of the flag.<br />
Boolは指定された名前は、デフォルト値、および使用状況の文字列でboolのフラグを定義します。戻り値はbool変数のアドレスは、フラグの値を格納します。</p>
<p>func Parse()<br />
Parse parses the command-line flags. Must be called after all flags are defined and before any are accessed by the program.<br />
Parseはコマンドラインフラグを解析します。後にすべてのフラグと定義される前に、任意のプログラムによってアクセスされる必要があります。</p>
<p>func NArg() int<br />
NArg is the number of arguments remaining after flags have been processed.<br />
NArgはフラグが処理された後に、残っている引数の数です。</p>
<p>func Arg(i int) string<br />
Arg returns the i&#8217;th command-line argument. Arg(0) is the first remaining argument after flags have been processed.<br />
Argはi番目のコマンドライン引数を返します。 フラグが処理された後、Arg(0)は最初の残っている引数。</p>
<p>あとfor文に括弧を付けない（CでもPHPでも付けるのに）ことに違和感を感じてしまった。<br />
シンプルだなー go lang</p>
]]></content:encoded>
			<wfw:commentRss>http://ecogrammer.manno.jp/2009/11/tutorial-for-go-lang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Go lang 使ってみました</title>
		<link>http://ecogrammer.manno.jp/2009/11/go-lang-%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%be%e3%81%97%e3%81%9f/</link>
		<comments>http://ecogrammer.manno.jp/2009/11/go-lang-%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%be%e3%81%97%e3%81%9f/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 15:28:05 +0000</pubDate>
		<dc:creator>manno</dc:creator>
				<category><![CDATA[memo]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tec]]></category>

		<guid isPermaLink="false">http://ecogrammer.manno.jp/?p=1313</guid>
		<description><![CDATA[<img src="http://ecogrammer.manno.jp/wp-content/uploads/2009/11/20091111-310x100.gif" alt="go lang" title="go lang" width="310" height="100" class="alignnone size-thumbnail wp-image-1316" />]]></description>
			<content:encoded><![CDATA[<p>とは言っても、 <a href="http://d.hatena.ne.jp/masibonge/20091111/1257919052">Google の新プログラミング言語 Go をMac OSX にインストール</a> に記載された通りに<br />
インストールとサンプルプログラムを実行してみただけです。</p>
<p>コンパイルは確かに早いというか（コンパイル）されたの？と感じました。</p>
<p>bin ディレクトリ作成<br />
&#8212;<br />
cd $HOME<br />
mkdir bin<br />
&#8212;</p>
<p>以下の内容で .bashrc を作成<br />
&#8212;<br />
# Google Go<br />
export GOROOT=$HOME/go<br />
export GOOS=darwin<br />
export GOARCH=386<br />
export PATH=$PATH:$HOME/bin<br />
&#8212;</p>
<p>&#8212;<br />
env | grep &#8216;^GO&#8217;<br />
&#8212;</p>
<p>で確認。すると結果は以下の通り（※私の環境の場合）</p>
<p>&#8212;<br />
GOARCH=386<br />
GOROOT=/Users/junji/go<br />
GOOS=darwin<br />
&#8212;</p>
<p>mercurialをインストール<br />
&#8212;<br />
sudo easy_install mercurial<br />
&#8212;</p>
<p>その後<br />
&#8212;<br />
$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT<br />
&#8212;</p>
<p>結構時間がかかります。<br />
以下省略・・・</p>
<p>hello.go を作成し「hello, go.」を出力するプログラムを作成<br />
&#8212;<br />
8g hello.go<br />
8l hello.8<br />
./8.out<br />
&#8212;<br />
コンパイルして、リンクさせて実行する。</p>
<p>結果は以下の通り。<br />
&#8212;<br />
hello, go.<br />
&#8212;</p>
<p>今後どのように展開されるのかひっそり見守りたいと思います。</p>
<p>参考：<a href="http://golang.org/">The Go Programming Language</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ecogrammer.manno.jp/2009/11/go-lang-%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%be%e3%81%97%e3%81%9f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

