- zeromq: stable 3.2.2
- go: 1.0.3
- gozmq: zmq_3_x
- python: 2.7.3
- pyzmq: 13.0.2
Example of the application of layered architecture style in go.
This application is based on the post.
File structure is...
$ tree $GOPATH/src/example.com/layered-arch-in-go
place the file terminalrc
into ~/.config/xfce4/terminal/terminalrc
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestFoo(t *testing.T) { | |
tests := []struct { | |
in string | |
out string | |
}{ | |
{in: "foo", out: "FOO"}, | |
} | |
for _, tt := range tests { | |
got := Foo(tt.in) | |
if got != tt.out { |
※本記事は2016/09/12 時点の情報をもとに構成しています
GoのWeb開発のためのフレームワークやライブラリについて、整理してみました。
整理するにあたり、いくつかのコンポーネントの分割単位を把握する必要があります。それを単体で提供しているのももあれば、複数の機能をまとめたツールセット(コンポーネント群)、全部入りのフルスタックまで幅広く存在しています。フルスタックなものは各コンポーネントを独自実装している場合が多いです。DBまでカバーしているのはbeego
くらいで、あとは利用者にお任せという仕様。Ruby on Railsのような巨大なものは存在しないと思います。
ライブラリを使わずに標準パッケージのみで構成するのも選択肢として考慮すべきでしょう。選ぶ基準はさまざまだと思いますので、ここではどのあたりが選択基準となるのかを考える材料を提供できればと思います。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum { | |
KONAMI = 1, | |
}; | |
[BASE] = KEYMAP( | |
M(KONAMI), // 好きなレイヤーのポジションに設定 | |
); | |
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |
{ |
エラーの階層化って深くなることはあまりないだろうし、ライブラリの中でWrapされることも少ないだろう。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
class Hoge(object): | |
def __init__(self, v): | |
self.val = v | |
def update(self, v): | |
self.val = v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Process._ | |
class Project(info: ProjectInfo) extends DefaultProject(info) { | |
val specs2 = "org.specs2" %% "specs2" % "1.5" % "test" | |
val squeryl = "org.squeryl" %% "squeryl" % "0.9.4" | |
val mysqlDriver = "mysql" % "mysql-connector-java" % "5.1.17" | |
} |
NewerOlder