nsq源码阅读1_目录结构

nsq源码阅读1_目录结构

执行tree命令

├─apps
│  ├─nsqadmin
│  ├─nsqd
│  ├─nsqlookupd
│  ├─nsq_stat
│  ├─nsq_tail
│  ├─nsq_to_file
│  ├─nsq_to_http
│  ├─nsq_to_nsq
│  └─to_nsq
├─bench
│  ├─bench_channels
│  ├─bench_reader
│  └─bench_writer
├─contrib
├─internal
│  ├─app
│  ├─auth
│  ├─clusterinfo
│  ├─dirlock
│  ├─http_api
│  ├─lg
│  ├─pqueue
│  ├─protocol
│  ├─quantile
│  ├─statsd
│  ├─stringy
│  ├─test
│  ├─util
│  ├─version
│  └─writers
├─nsqadmin
│  ├─static
│  │  ├─build
│  │  ├─css
│  │  ├─fonts
│  │  ├─html
│  │  ├─img
│  │  └─js
│  │      ├─collections
│  │      ├─lib
│  │      ├─models
│  │      └─views
│  └─test
├─nsqd
│  └─test
│      └─certs
├─nsqlookupd
└─sedlf_test
    └─http_get_post

nsq包括 admin , lookup, nsqd每个大型构件占用一个文件夹。在最外层的apps是cli的main,进入外面的nsqlookup,没采用分层,想opmq一样,避免回包,指针方便

源码编译

项目clone下来,去掉go.mod和go.sum

  1. 自己 执行 go mod init github.com/nsqio/nsq

  2. 首先看源码肯定是先盯着nsqlookup看,在下面go build

    千万不要go run main.go 因为他的函数main.go有两个, 像beego一样恶心

原文地址:https://www.cnblogs.com/maomaomaoge/p/15342862.html