https://github.com/olehan/marker
✏️ Work with Golang plugins easier
https://github.com/olehan/marker
go go-module go-plugins golang marker
Last synced: about 1 year ago
JSON representation
✏️ Work with Golang plugins easier
- Host: GitHub
- URL: https://github.com/olehan/marker
- Owner: olehan
- License: mit
- Created: 2019-08-11T14:31:50.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-13T11:17:15.000Z (almost 7 years ago)
- Last Synced: 2025-02-12T10:19:25.483Z (over 1 year ago)
- Topics: go, go-module, go-plugins, golang, marker
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
✏️ Marker
Mark your golang plugin file to get the best of it
----
Usage
|
Installation
|
License
----
I know that this (✏️) is not a marker, but I do not have anything better \( ̄▽ ̄)/
Usage
*Actually I'd suggest you to go into the [examples directory](examples) to see more usage
variations.*
***Project:***
```
project
├── config.go
└── app/
└── main.go
```
***config.go***
```go
package main // Notice that the package has to be main to build a plugin.
// Variables and functions also have to be public to import them using marker.
var ApiUrl = "https://api.github.com"
```
***app/main.go***
```go
package main
import (
"fmt"
"github.com/olehan/marker"
"github.com/olehan/marker/path"
)
func main() {
// Here we're marking our file as a plugin and telling the marker what we need
// and what it should be.
output, err := marker.Mark(
path.RelativeToCaller("../config.go"),
// We're specifying the variable's name and its type so marker could
// validate the value that was imported from the plugin.
marker.NewMarker("ApiUrl", marker.StringValue),
)
if err != nil {
panic(err)
}
// Symbol's always pointer.
apiUrl := output.(*string)
fmt.Println("apiUrl:", *apiUrl)
}
```
Installation
```sh
$ go get github.com/olehan/marker
```
License
[MIT](LICENSE)