github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/README.md (about) 1 # libgo 2 [![GoDoc](https://pkg.go.dev/badge/github.com/GeniusesGroup/libgo)](https://pkg.go.dev/github.com/GeniusesGroup/libgo) 3 [![Go Report](https://goreportcard.com/badge/github.com/GeniusesGroup/libgo)](https://goreportcard.com/report/github.com/GeniusesGroup/libgo) 4 5 An **application** developing **framework** provide ZeroOps(zero operations), edge computing, ... that let you develope both server and client applications in Go without need to think more about any fundamental requirements, Just develope business services and user interfaces (now just graphical interface - gui), build apps as OS images or OS applications and easily just run first server node and let it distributes by many factors with inside logics not need external decision makers (automating software deployment) like Kubernetes(K8s). 6 7 In other word, `libgo` abbreviation of `Go language library` is a repository wrapper to store all implementation of GeniusesGroup and others protocols and algorithms to make a digital software more easily in better performance. 8 You can use all packages exported APIs, go generator mechanism or by [library CLI](#CLI) to access some useful APIs from command line easily. 9 10 ## Goals 11 - Provide complete framework to develope any purpose distributed application with **low||no code**. 12 - No(minimum) dependency on any other repositories. 13 - Compile an application as **Unikernel** instead of regular OSs binaries. 14 - Develope high available and distributed software without any admin in any infrastructure layers (DevOps culture goal). 15 - Let service developers act Lean and Agile in their organization. 16 - [Reinvent the wheel](https://en.wikipedia.org/wiki/Reinventing_the_wheel) 17 18 ## Not Goals 19 - 20 21 ## Installation 22 - Make project directory and suggest use your internet domain name for it. 23 - initialize project version control. If you use git run `git init` or `git clone ${repository path}`. 24 - init go project by `git init` and `go mod init` 25 - add `libgo` to your project dependency 26 - install `libgo` with `lang_eng` or your desire language 27 - initialize the project with desire domain e.g. `google.com` 28 - build your organization app by `libgo build` or by `go build` with desire tags and target OS and hardwares. 29 - run your desire version from /bin/ directory. Strongly suggest run app by systemd on linux or other app manager on other OS. 30 31 or easily run the following command under your project, just replace your domain name. 32 ``` 33 mkdir {domain} 34 git init 35 go mod init 36 go get -u github.com/GeniusesGroup/libgo 37 go install github.com/GeniusesGroup/libgo -tags "lang_eng" 38 libgo app init -d={domain} 39 libgo build 40 ``` 41 42 ## Commands (CLA) 43 libgo has a the command-line client for the some generator APIs implement in [modules](./modules/). It provides simple access to all APIs functions to make an application, a GUI app, .... 44 45 You can get list of all commands and their helps with `libgo help`. We just list some of important commands here that you can run them from within a Go module or any where in your project directory: 46 - **Initialize a project:** `libgo app init -d=[internet-domain]` 47 - **Add new domain module:** `libgo domain new -n=[domain-name]` 48 49 ## Build tags 50 - **dev_mode**: first check and change `AppMode_Dev` const in protocol package to desire behavior 51 - **tcp_listener**: 52 53 ### Developing hints 54 - Complete manifest in main package of service. 55 - Add other data to main package if needed. 56 - Implement protocols logic by autogenerate some codes not write them manually. 57 - Don't think about network when you develope a business service logic. Use `st protocol.Stream` as stream data not network stream and don't remove it even don't need it from `Process` method arguments. 58 59 ## Protocols 60 You can find protocol descriptions in its directory as now [protocol](./protocol/), [society](./society/), [ISO](./iso/) 61 Read more about each protocol or library in its [RFC](https://github.com/GeniusesGroup/RFCs) 62 As [suggest here](https://github.com/golang/go/issues/48087) to comply with the standards we add [protocol](./protocol) package and all other libgo packages implement this package. You can implement these protocols in your own way if our packages can't satisfied you or your requirements. 63 A standard is a formalized protocol accepted by most of the parties that implement it. A protocol is not a set of rules. A protocol is the thing those rules describe the rules of. This is why programs implement a protocol and comply with a standard. 64 65 ### Industry Protocols 66 - Insurance >> ACCORD 67 - Health Care >> HL7 68 - Retail >> GS1 69 - HR >> HRXML 70 71 ## GIT 72 Git is not the best version control mechanism for a software project, but it is the most use one. 73 74 ### Some useful commands 75 - Make project version control by ```git init``` 76 - Clone exiting repo by ```git clone ${repository path}```. 77 - Add libgo to project as submodule by ```git submodule add -b master https://github.com/GeniusesGroup/libgo``` 78 - Clone existing project with just latest commits not all one ```git clone ${repository path} --recursive --shallow-submodules``` 79 - Change libgo version by ```git checkout tag/${tag}``` or update by ```git submodule update -f --init --remote --checkout --recursive``` if needed. 80 81 ## Go 82 ### Some useful commands 83 - go build -race 84 - go tool compile -S {{file-name}}.go > {{file-name}}_C.S 85 - go tool objdump {{file-name}}.o > {{file-name}}_O.S 86 - go build -gcflags=-m {{file-name}}.go 87 - go run -gcflags='-m -m' {{file-name}}.go 88 - go build -ldflags "-X version=0.1" 89 90 ### build tags 91 Some functionality in files that have build tags `//go:build tag_name` or `// +build tag_name` in the first line just build when you provided in build time like `go build -tags "dev_mode tcp_listener"`. Build tag declarations must be at the very top of a .go files. Nothing, not even comments, can be above build tags. We prefer `go:build` over `+build` because as [describe in the proposal](https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md#transition) but below chart is how to declare in `+build` style. 92 93 | Build Tag Syntax | Build Tag Sample | Boolean Statement | 94 | :---: | :---: | :---: | 95 | Space-separated elements | // +build pro enterprise | pro OR enterprise | 96 | Comma-separated elements | // +build pro,enterprise | pro AND enterprise | 97 | New line separated elements | // +build pro<br />// +build enterprise | pro AND enterprise | 98 | Exclamation point elements | // +build !pro | NOT pro | 99 100 ## Contribute Rules 101 - Write benchmarks and tests codes in different files as `{{file-name}}_test.go` and `{{file-name}}_bench_test.go` 102 103 ## Enterprise 104 Contact us by [this](mailto:ict@geniuses.group) or [this](mailto:omidhekayati@gmail.com) if you need enterprise support for developing high available and distributed software. See features available in enterprise package: 105 - Develope exclusive features in very short time 106 - Bug fixing quickly 107 - 108 109 ## Good Idea, Bad implementation! 110 - [SQLc](sqlc.dev) 111 - [EntGo](https://entgo.io/) 112 - [go-zero](https://github.com/zeromicro/go-zero) e.g. (microservice system), (fully compatible with net/http), (middlewares are supported), ... 113 or [really relativetime?? Why not monotonic time??](https://github.com/zeromicro/go-zero/blob/master/core/timex/relativetime.go) 114 115 ## Related Projects 116 - [Clive is an operating system designed to work in distributed and cloud computing environments.](https://github.com/fjballest/clive) 117 118 ## Abbreviations & Definitions 119 - **UI**: (any) User Interface 120 - **GUI**: Graphic User Interface 121 - **VUI**: Voice User Interface 122 - **CLI**: Command Line Interface 123 - **CLA**: Command Line Arguments 124 - **Modules**: a kind of collection of packages 125 - **Packages**: a kind of collection of files 126 - **dp**: domain protocol 127 - **init**: initialize call just after an object allocate. 128 - **reinit**: re-initialize call when allocated object want to reuse immediately or pass to a pool to reuse later. It will prevent memory leak by remove any references in the object. 129 - **deinit**: de-initialize call just before an object want to de-allocated (GC). 130 - **open**: 131 - **reset**: 132 - **close**: