traefik / plugindemo

This repository includes an example plugin, for you to use as a reference for developing your own plugins
https://plugins.traefik.io/plugins/628c9ee2108ecc83915d7764/demo-plugin
Apache License 2.0
136 stars 44 forks source link

Fixes to clarify `dev mode` #3

Closed PCM2 closed 4 years ago

PCM2 commented 4 years ago

This PR adds some language to the developer docs to clarify how "dev mode" works for testing plugins. Specifically, it makes clear that:

ldez commented 4 years ago

Dev mode plugins are loaded from the local GOPATH

It's wrong: the GOPATH from Go is not used, the dev plugins can use any path as gopath and there is no default.

GOPATH is an env var and we don't use this env var.

trois-six commented 4 years ago

I think that @PCM2 was speaking about the goPath set in the static config.

ldez commented 4 years ago

I understand because I know how it works but only few people will understand that.

I prefer to not use the word (in uppercase) GOPATH or the term "local" to describe the plugin behavior.

PCM2 commented 4 years ago

I prefer to not use the word (in uppercase) GOPATH or the term "local" to describe the plugin behavior.

OK, understood on "GOPATH" but you invented the spelling "GoPath," which no one will understand, either. Can we say you need to "specify a path to a Go workspace"?

Why do you not like "local"? I think this will be the #1 factor that will be important to people using dev mode -- that the plugin is loaded from the local machine (local to Traefik) rather than from GitHub.

ldez commented 4 years ago

Why do you not like "local"?

Because my local GOPATH is the GOPATH, yes I'm a Go dev :smile:

Can we say you need to "specify a path to a Go workspace"?

Yes and we can add: "The Go workspace is the equivalent of the concept of GOPATH for a local Go environment dedicated to plugins. It can be the local GOPATH or any directory."

We can also use gopath (in lower case) as the go command line.

Note: I recommend to not use the local GOPATH as gopath because it can cause some side effect with dependencies (ex: a dependency can be use from the GOPATH instead of the vendor folder).

PCM2 commented 4 years ago

See if this change does it for you.