Skip to content

Commit

Permalink
regex assert
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Feb 21, 2024
1 parent f1b1897 commit a3f8c03
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tools/teamcity-diff-check/main.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
/*
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/

// This file is controlled by MMv1, any changes made here will be overwritten

package main

import (
Expand Down Expand Up @@ -64,6 +55,10 @@ func main() {
service := pattern.Expand(dst, template, stdout, submatches)
googleServices = append(googleServices, string(service))
}
if len(googleServices) == 0 {
fmt.Fprintf(os.Stderr, "googleServices error: regex produced no matches.\n")
os.Exit(1)
}

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -100,6 +95,10 @@ func main() {
service := pattern.Expand(dst, template, bs, submatches)
teamcityServices = append(teamcityServices, string(service))
}
if len(teamcityServices) == 0 {
fmt.Fprintf(os.Stderr, "teamcityServices error: regex produced no matches.\n")
os.Exit(1)
}

if diff := serviceDifference(googleServices, teamcityServices); len(diff) != 0 {
fmt.Fprintf(os.Stderr, "error: diff in %s\n", *serviceFile)
Expand Down

0 comments on commit a3f8c03

Please sign in to comment.