influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.63k stars 5.58k forks source link

`make docs` doesn't work on Windows #13681

Closed gazpachoking closed 1 year ago

gazpachoking commented 1 year ago

Running make docs on Windows doesn't work.

Logs from make docs

config_includer:

go generate -run="tools/config_includer/generator" ./plugins/inputs/...
2023/07/27 00:08:57 Reading template "\\plugins\\inputs\\http\\sample.conf.in" failed: open \plugins\inputs\http\sample.conf.in: The system cannot find the path specified.
plugins\inputs\http\http.go:1: running "../../../tools/config_includer/generator": exit status 1

readme_config_includer

2023/07/27 00:10:54 Ignoring include "C:\\docs\\includes\\plugin_config.md" as it cannot be found or is not a regular file...

Additional info

This is happening because filepath.IsAbs is being used to check if a path starts with /. On windows however, this will return false for paths that start with slash. The following branch has a fix, but it's a bit messy in config_includer due to the paths sometimes having backslashes (the initial path), and sometimes having slashes (recursive includes), so there's probably some better cleanup that could be done. https://github.com/influxdata/telegraf/compare/master...gazpachoking:telegraf:make_docs_windows

powersj commented 1 year ago

@gazpachoking - feel free to put up the PR and we can work through it.