Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.30.0 #567

Merged
merged 44 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4dd7025
Back to development
witriew Sep 9, 2021
b9cd964
Back to development (#546)
witriew Sep 9, 2021
8f8ed5e
Update the toolchain and CI (#547)
abhinav Sep 9, 2021
c06ddf6
gen/test: Merge thriftType and streamingThriftType (#548)
abhinav Sep 10, 2021
f753432
More tests with streaming (#549)
witriew Sep 11, 2021
1c26d5c
Intial commit with working tests on detecting whether a required fiel…
shirchen Aug 26, 2021
b2fa4cd
Adding support for deletion of services.
shirchen Aug 26, 2021
30e5c01
Add a lot more tests
shirchen Aug 26, 2021
1ae3777
Fix lint errors.
shirchen Aug 26, 2021
7949f36
Fix lint for real.
shirchen Aug 26, 2021
b890679
Checkpoint where I refactored into package errors, and added aworking…
shirchen Sep 10, 2021
8b50190
Checkpoint for git implementation.
shirchen Sep 13, 2021
e7914d3
gofmt
shirchen Sep 13, 2021
626a978
Simplify code a bit.
shirchen Sep 13, 2021
696abae
add feedback.
shirchen Sep 14, 2021
5b5ac62
Support include statements.
shirchen Sep 14, 2021
0df83bd
add copyright headers fix tests
shirchen Sep 21, 2021
47e99df
All tests pass.
shirchen Sep 21, 2021
51bd6c2
Fix lint errors (gofmt).
shirchen Sep 21, 2021
656dbf6
remove unused test data
shirchen Sep 21, 2021
a740050
remove whitelist for vendored libs
shirchen Sep 21, 2021
b1ed2c5
Checkpoint addressing comments.
shirchen Sep 23, 2021
e3735c4
Remove errors in favor of Message.
shirchen Sep 23, 2021
12a7dab
refactored service
shirchen Sep 23, 2021
8e02525
Checkpoing types refactor.
shirchen Sep 23, 2021
ff12807
Addressing comments in git.go
shirchen Sep 23, 2021
b33463a
Finish refactoring git.
shirchen Sep 24, 2021
1d517f8
Rename to compareModules
shirchen Sep 24, 2021
279c89b
Addressing feedback.
shirchen Sep 28, 2021
22b9cf4
Add thriftbreak, a backwards compatibility linter.
shirchen Sep 28, 2021
c72405a
Fixing a bug in thriftbreak to detect commit changes that add a new f…
shirchen Oct 22, 2021
ab2e4a7
Add a flag to thriftbreak to output results as JSON. (#551)
shirchen Dec 3, 2021
944fb9f
Addressing missed feedback from #551 and returning FilePath (#553)
shirchen Dec 3, 2021
8dab387
gen: Optimize String() for typedef string (#554)
kishoresenji Feb 18, 2022
062fbbf
Update copyright range to include 2022 (#555)
jparise Mar 1, 2022
72c3f0b
CI: Run on Go 1.17/1.18 (#557)
abhinav Mar 15, 2022
183888f
Upgrade to yaml.v3 3.0.1 (#558)
abhinav May 31, 2022
e6d71ae
Add support for changed types in thriftbreak (#559)
moisesvega Oct 10, 2022
69e460a
idl: Fix parsing of hex integer values (#560)
KarboniteKream Feb 13, 2023
003b781
build(deps): bump golang.org/x/net (#562)
dependabot[bot] Mar 7, 2023
fce4fe9
Add new TemplateOption AddTemplate (#564)
clayne11 Mar 14, 2023
dd3a006
Update changelog (#565)
r-hang Apr 4, 2023
f4b1af6
release preparation: make generate (#566)
r-hang Apr 4, 2023
8837a25
Preparing release v1.30.0
r-hang Apr 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.15.x", "1.16.x"]
go: ["1.17.x", "1.18.x"]
include:
- go: 1.16.x
- go: 1.18.x
latest: true

steps:
Expand Down
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,3 @@ cover.full.out
cover.html
.idea/

# We will explicitly whitelist vendored libraries that we want to check in.
vendor/*
!vendor/github.com/

/vendor/github.com/*
!vendor/github.com/fatih/

vendor/github.com/fatih/*
!vendor/github.com/fatih/structtag
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.30.0] - 2023-04-04
### Added
- AddTemplate template option.
- thriftbreak: support for changed types, new files, and optional JSON output.
### Changed
- String() performance improvements for string type definitions.

## [1.29.2] - 2021-09-09
### Fixed
- Streaming now handles unrecongized fields and non-matching field types when
Expand Down Expand Up @@ -427,6 +434,7 @@ this release.
### Added
- Initial release.

[1.30.0]: https://github.com/thriftrw/thriftrw-go/compare/v1.29.2...v1.30.0
[1.29.2]: https://github.com/thriftrw/thriftrw-go/compare/v1.29.1...v1.29.2
[1.29.1]: https://github.com/thriftrw/thriftrw-go/compare/v1.29.0...v1.29.1
[1.29.0]: https://github.com/thriftrw/thriftrw-go/compare/v1.28.0...v1.29.0
Expand Down
19 changes: 9 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ LINT_EXCLUDES = \
plugin/api/plugin.go \
plugin/api/plugin_client.go \
plugin/api/servicegenerator.go \
plugin/api/servicegenerator_client.go \
vendor/
plugin/api/servicegenerator_client.go

# For tests on generated code, ignore deprecated warnings.
LINT_EXCLUDES += gen/.*_test.go:.*deprecated
Expand All @@ -33,20 +32,20 @@ LINT_EXCLUDES += unknown.*JSON.*option.*required
RAGEL_TAR = $(BUILD_DIR)/src/ragel-$(RAGEL_VERSION).tar.gz

GO_FILES := $(shell \
find . '(' -path '*/.*' -o -path './vendor' ')' -prune \
find . -path '*/.*' -prune \
-o -name '*.go' -print | cut -b3-)

# Installs dependencies listed in tools_test.go.
.PHONY: tools
tools:
go list -json tools_test.go | jq -r '.TestImports | .[]' | xargs -n1 go install

.PHONY: build
build: $(THRIFTRW)

.PHONY: ragel
ragel: $(RAGEL)

# Installs dependencies listed in tools_test.go.
.PHONY: tools
tools:
go list -json tools_test.go | jq -r '.TestImports | .[]' | xargs -n1 go install

$(THRIFTRW): $(GO_FILES)
go install .

Expand Down Expand Up @@ -122,8 +121,7 @@ COVER_IGNORE_FILES = \
$(wildcard plugin/api/*.go)

# literal space
space :=
space +=
space := $(subst ,, )

.PHONY: cover
cover:
Expand All @@ -133,4 +131,5 @@ cover:

.PHONY: clean
clean:
rm $(THRIFTRW)
go clean
2 changes: 1 addition & 1 deletion ast/annotation.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/basetypeid_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ast/constant.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/definition.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/header.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 8 additions & 7 deletions ast/mock_visitor_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ast/node.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/position.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/program.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/type.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/visitor.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ast/walk.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down
109 changes: 109 additions & 0 deletions cmd/thriftbreak/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package main

import (
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"log"
"os"

"go.uber.org/thriftrw/internal/compare"
"go.uber.org/thriftrw/internal/git"
)

func main() {
if err := run(os.Args[1:]); err != nil && !errors.Is(err, flag.ErrHelp) {
log.Fatalf("%+v", err)
}
}

// readableOutput prints every lint error on a separate line.
func readableOutput(w io.Writer) func(compare.Diagnostic) error {
return func(diagnostic compare.Diagnostic) error {
if _, err := fmt.Fprintln(w, &diagnostic); err != nil {
return fmt.Errorf("failed to output a lint error: %v", err)
}

return nil
}
}

// jsonOutput prints out every lint error in JSON format.
func jsonOutput(w io.Writer) func(compare.Diagnostic) error {
enc := json.NewEncoder(w)

return func(diagnostic compare.Diagnostic) error {
// Encode adds a trailing newline.
if err := enc.Encode(diagnostic); err != nil {
return fmt.Errorf("encode as JSON: %v", err)
}

return nil
}
}

func run(args []string) error {
flag := flag.NewFlagSet("thriftbreak", flag.ContinueOnError)
gitRepo := flag.String("C", "",
"location of git repository. Defaults to current directory.")
jsonOut := flag.Bool("json", false,
"output as a list of newline-delimited JSON objects with the following fields: FilePath and Message")
if err := flag.Parse(args); err != nil {
return err
}

if *gitRepo == "" {
cwd, err := os.Getwd()
if err != nil {
return fmt.Errorf("cannot determine current directory: %v", err)
}
*gitRepo = cwd
}

pass, err := git.Compare(*gitRepo)
// Errors in compiling phase, but not in backwards compatibility.
if err != nil {
return err
}

var write func(compare.Diagnostic) error
if *jsonOut {
write = jsonOutput(os.Stdout)
} else {
write = readableOutput(os.Stdout)
}
lints := pass.Lints()
for _, l := range lints {
if err := write(l); err != nil {
return fmt.Errorf("failed to output error: %v", err)
}
}

if len(lints) > 0 {
return fmt.Errorf("found %d issues", len(lints))
}

return nil
}
Loading