1// Copyright The OpenTelemetry Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package main
16
17import (
18	"flag"
19)
20
21const (
22	// Absolute root path of the project
23	projectPath = "project-path"
24	// Relative path where imports all default components
25	relativeDefaultComponentsPath = "component-rel-path"
26	// The project Go Module name
27	projectGoModule = "module-name"
28)
29
30// The main verifies if README.md and proper documentations for the enabled default components
31// are existed in OpenTelemetry core and contrib repository.
32// Usage in the core repo:
33// checkdoc --project-path path/to/project \
34//			--component-rel-path service/defaultcomponents/defaults.go \
35//			--module-name go.opentelemetry.io/collector
36//
37// Usage in the contrib repo:
38// checkdoc --project-path path/to/project \
39//			--component-rel-path cmd/otelcontrib/components.go \
40//			--module-name github.com/open-telemetry/opentelemetry-collector-contrib
41//
42func main() {
43	projectPath := flag.String(projectPath, "", "specify the project path")
44	componentPath := flag.String(relativeDefaultComponentsPath, "", "specify the relative component path")
45	moduleName := flag.String(projectGoModule, "", "specify the project go module")
46
47	flag.Parse()
48
49	err := checkDocs(
50		*projectPath,
51		*componentPath,
52		*moduleName,
53	)
54
55	if err != nil {
56		panic(err)
57	}
58}
59