This file contains hidden or 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 main() { | |
| f, err := os.Open("hoge.txt") | |
| if err != nil { | |
| println("Err") | |
| } | |
| ret, err := f.Seek(0, 1) //ファイルオフセットの現在位置を取得 | |
| if err != nil { | |
| println("Err") | |
| } | |
| println(ret) |
This file contains hidden or 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 main() { | |
| f, err := os.Open("hoge.txt") | |
| if err != nil { | |
| println("Err") | |
| } | |
| // 1回目 | |
| err = file_scan(f) | |
| if err != nil { | |
| println("Err") | |
| } |
This file contains hidden or 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 main() { | |
| f, err := os.Open("hoge.txt") | |
| if err != nil { | |
| println("Err") | |
| } | |
| libraryFunc(f) | |
| scanner := bufio.NewScanner(f) | |
| for scanner.Scan() { |
This file contains hidden or 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 deriveEqual(this, that *MyStruct) bool { | |
| return (this == nil && that == nil) || | |
| this != nil && that != nil && | |
| this.Int64 == that.Int64 && | |
| ((this.StringPtr == nil && that.StringPtr == nil) || | |
| (this.StringPtr != nil && that.StringPtr != nil && *(this.StringPtr) == *(that.StringPtr))) | |
| } |
This file contains hidden or 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
| package main | |
| type MyStruct struct { | |
| Int64 int64 | |
| StringPtr *string | |
| } | |
| func (this *MyStruct) Equal(that *MyStruct) bool { | |
| return deriveEqual(this, that) | |
| } |
This file contains hidden or 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
| # -*- encoding: utf-8 -*- | |
| Gem::Specification.new do |gem| | |
| gem.authors = ["Hidemasa Togashi", "Masahiro Nakagawa"] | |
| gem.email = ["togachiro@gmail.com", "repeatedly@gmail.com"] | |
| gem.description = %q{Fluentd plugin for Apache Kafka > 0.8} | |
| gem.summary = %q{Fluentd plugin for Apache Kafka > 0.8} | |
| gem.homepage = "https://github.com/fluent/fluent-plugin-kafka" | |
| gem.files = `git ls-files`.split($\) |
This file contains hidden or 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
| WARN Unexpected state transition from RUNNING to NOT_RUNNING (org.apache.kafka.streams.processor.internals.StreamThread) | |
| Exception in thread "StreamThread-1" org.apache.kafka.streams.errors.StreamsException: Input record ConsumerRecord(topic = hoge, partition = 0, offset = 0, CreateTime = -1, checksum = 4178856401, serialized key size = -1, serialized value size = 520, key = null, | |
| value = {"level":"info","ts":1503563975.9925625,"caller":"","msg":"tracking.request","RequestData":[{"Request":{"Host":"","Method":"POST","Proto":"HTTP/1.1","Referer":"","RemoteAddr":"","RequestURI":"/","UA":"curl/7.51.0","URL":"/"}},{"Header":[{"Content-Type":["application/json"]},{"Content-Length":["25"]},{"User-Agent":["curl/7.51.0"]},{"Accept":["application/json"]}]},{"Body":"{}"},{"Form":[]},{"PostForm":[]},{"Cookie":[]}]}) | |
| has invalid (negative) timestamp. Possibly because a pre-0.10 producer client was used to write this record to Kafka without embedding a timestamp, or because the input topic was created before upgrading the |
This file contains hidden or 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 DoSomethingVerbosely(foo *Foo, verbosity int) { | |
| // Could combine the next two lines, | |
| // with some loss of readability. | |
| prev := foo.Option(pkg.Verbosity(verbosity)) | |
| defer foo.Option(prev) | |
| // ... do some stuff with foo under high verbosity. | |
| } |
This file contains hidden or 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
| prevVerbosity := foo.Option(pkg.Verbosity(3)) | |
| foo.DoSomeDebugging() | |
| foo.Option(prevVerbosity) |
This file contains hidden or 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
| // Verbosity sets Foo's verbosity level to v. | |
| func Verbosity(v int) option { | |
| return func(f *Foo) option { | |
| previous := f.verbosity | |
| f.verbosity = v | |
| return Verbosity(previous) | |
| } | |
| } |