Removing unused directory `buildifier2` (#1350)

Co-authored-by: Tim Malmström <oreflow@google.com>
diff --git a/buildifier/BUILD.bazel b/buildifier/BUILD.bazel
index 8863e49..1f1cd67 100644
--- a/buildifier/BUILD.bazel
+++ b/buildifier/BUILD.bazel
@@ -84,11 +84,9 @@
     srcs = ["integration_test.sh"],
     args = [
         "$(location :buildifier)",
-        "$(location //buildifier2)",
     ],
     data = [
         ":buildifier",
-        "//buildifier2",
     ],
     deps = ["@bazel_tools//tools/bash/runfiles"],
 )
diff --git a/buildifier/config/config_test.go b/buildifier/config/config_test.go
index 7554385..60e5b3e 100644
--- a/buildifier/config/config_test.go
+++ b/buildifier/config/config_test.go
@@ -615,9 +615,9 @@
 		},
 		"BUILDIFIER_CONFIG-override": {
 			env: map[string]string{
-				"BUILDIFIER_CONFIG": ".buildifier2.json",
+				"BUILDIFIER_CONFIG": ".buildifier_x.json",
 			},
-			want: ".buildifier2.json",
+			want: ".buildifier_x.json",
 		},
 	} {
 		t.Run(name, func(t *testing.T) {
diff --git a/buildifier/integration_test.sh b/buildifier/integration_test.sh
index 1a1511e..26d2fce 100755
--- a/buildifier/integration_test.sh
+++ b/buildifier/integration_test.sh
@@ -29,9 +29,7 @@
 }
 
 [[ "$1" =~ external/* ]] && buildifier="${{1#external/}}" || buildifier="$TEST_WORKSPACE/$1"
-[[ "$2" =~ external/* ]] && buildifier2="${{2#external/}}" || buildifier2="$TEST_WORKSPACE/$2"
 buildifier="$(rlocation "$buildifier")"
-buildifier2="$(rlocation "$buildifier2")"
 
 touch WORKSPACE.bazel
 [[ -d test_dir ]] && rm -r test_dir
@@ -135,7 +133,6 @@
 "$buildifier" --path=foo.bzl test2.bzl
 "$buildifier" --config=test_dir/.buildifier.test.json < test_dir/test.bzl > test_dir/test.bzl.BUILD.out
 "$buildifier" --config=example > test_dir/.buildifier.example.json
-"$buildifier2" test_dir/test.bzl > test_dir/test.bzl.out
 
 cat > golden/BUILD.golden <<EOF
 load(":foo.bzl", "foo")
@@ -371,7 +368,6 @@
 diff -u test.bzl golden/test.bzl.golden
 diff -u test2.bzl golden/test.bzl.golden
 diff -u stdout golden/test.bzl.golden
-diff -u test_dir/test.bzl.out golden/test.bzl.golden
 diff -u test_dir/.git/git.bzl golden/git.bzl
 diff -u test_dir/MODULE.bazel golden/MODULE.bazel.golden
 diff -u test_dir/.buildifier.example.json golden/.buildifier.example.json
diff --git a/buildifier2/BUILD.bazel b/buildifier2/BUILD.bazel
deleted file mode 100644
index 78cb8f5..0000000
--- a/buildifier2/BUILD.bazel
+++ /dev/null
@@ -1,19 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
-
-go_library(
-    name = "buildifier2_lib",
-    srcs = ["buildifier2.go"],
-    importpath = "github.com/bazelbuild/buildtools/buildifier2",
-    visibility = ["//visibility:private"],
-    deps = [
-        "//build",
-        "//convertast",
-        "@net_starlark_go//syntax",
-    ],
-)
-
-go_binary(
-    name = "buildifier2",
-    embed = [":buildifier2_lib"],
-    visibility = ["//visibility:public"],
-)
diff --git a/buildifier2/buildifier2.go b/buildifier2/buildifier2.go
deleted file mode 100644
index 82ca4b8..0000000
--- a/buildifier2/buildifier2.go
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-Copyright 2020 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
-
-    https://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.
-*/
-
-// An alternative implementation of Buildifier, on top of the Skylark parser.
-// https://go.starlark.net/
-
-// This is experimental.
-
-// If the experiment is successful, we might drop the AST defined in this
-// package and use the AST from go.starlark.net/syntax. This will give
-// us a much more precise AST and will allow us to share code with the
-// Skylark interpreter. The end goal is to build a number of tools able
-// to parse, analyze, format, refactor, evaluate Skylark code.
-
-// Package main implements a buildifier on top of 'Skylark in Go'.
-package main
-
-import (
-	"flag"
-	"fmt"
-	"log"
-
-	"github.com/bazelbuild/buildtools/build"
-	"github.com/bazelbuild/buildtools/convertast"
-	"go.starlark.net/syntax"
-)
-
-func main() {
-	flag.Parse()
-
-	switch len(flag.Args()) {
-	case 0:
-		log.Fatal("Argument missing")
-	case 1:
-		filename := flag.Args()[0]
-		ast, err := syntax.Parse(filename, nil, syntax.RetainComments)
-		if err != nil {
-			log.Fatalf("%+v\n", err)
-		}
-		newAst := convertast.ConvFile(ast)
-		fmt.Print(build.FormatString(newAst))
-
-	default:
-		log.Fatal("want at most one Skylark file name")
-	}
-}