Skip to content

Commit

Permalink
[Go] use a Makefile to generate doc-go files (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
jba authored Jun 25, 2024
1 parent eecfe21 commit 7b28c2b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs-go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
WEAVE=$(HOME)/go/bin/weave

all: $(WEAVE) flows.md models.md

$(WEAVE): ../go/internal/cmd/weave/*.go
go -C ../go install ./internal/cmd/weave

%.md: %.src
$(WEAVE) $< > $@

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions go/internal/cmd/weave/weave.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ func cleanListing(text, indent string) string {
return strings.Join(lines, "\n")
}

// leadingTabs counts the number of tabs that start s.
func leadingTabs(s string) int {
var i int
for i = 0; i < len(s); i++ {
Expand Down
19 changes: 19 additions & 0 deletions go/internal/doc-snippets/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package snippets contains snippets that are incorporated into
// documentation (see the docs-go directory under the repo root).
package snippets

//go:generate make -C ../../../docs-go

0 comments on commit 7b28c2b

Please sign in to comment.