-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mage: add check that links are live in the OTel README
This PR adds a utility based on the `link-patrol` command to check if links in a given file are live. Added a check in the `check` and `otel:readme` targets to validate all links in the Otel Readme are valid.
- Loading branch information
Showing
7 changed files
with
119 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package gotool | ||
|
||
import ( | ||
"github.com/magefile/mage/sh" | ||
) | ||
|
||
type goLinkCheck func(opts ...ArgOpt) error | ||
|
||
// LinkCheck runs `link-patrol` to verify links in files and provides optionals for adding command line arguments. | ||
var LinkCheck goLinkCheck = runGoLinkCheck | ||
|
||
func runGoLinkCheck(opts ...ArgOpt) error { | ||
args := buildArgs(opts).build() | ||
return sh.RunV("link-patrol", args...) | ||
} | ||
|
||
func (goLinkCheck) Path(path string) ArgOpt { return flagArgIf("-f", path) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.