<commit_before>/*
Copyright 2016 Google Inc. All Rights Reserved.
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.
*/

// The goopack binary creates a GooGet package using the provided GooSpec file.
package main

import (
	"archive/tar"
	"compress/gzip"
	"flag"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"regexp"
	"runtime"
	"strings"

	"github.com/google/googet/goolib"
	"github.com/google/googet/oswrap"
)

var outputDir = flag.String("output_dir", "", "where to put the built package")

type fileMap map[string][]string

// walkDir returns a list of all files in directory and subdirectories, it is similar
// to filepath.Walk but works even if dir is a symlink, which is the case with blaze Filesets.
func walkDir(dir string) ([]string, error) {
	rl, err := ioutil.ReadDir(dir)
	if err != nil {
		return nil, err
	}
	var wl []string
	for _, fi := range rl {
		path := filepath.Join(dir, fi.Name())

		// follow symlinks
		if (fi.Mode() & os.ModeSymlink) != 0 {
			if fi, err = oswrap.Stat(path); err != nil {
				return nil, err
			}
		}
		if !fi.IsDir() {
			wl = append(wl, path)
			continue
		}<commit_msg>Update goopack.go<commit_after>/*
Copyright 2016 Google Inc. All Rights Reserved.
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.
*/

// The goopack binary creates a GooGet package using the provided GooSpec file.
package main

import (
	"archive/tar"
	"compress/gzip"
	"flag"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"regexp"
	"runtime"
	"strings"

	"github.com/google/googet/goolib"
	"github.com/google/googet/oswrap"
)

var outputDir = flag.String("output_dir", "", "where to put the built package")

type fileMap map[string][]string

// walkDir returns a list of all files in directory and subdirectories, it is similar
// to filepath.Walk but works even if dir is a symlink.
func walkDir(dir string) ([]string, error) {
	rl, err := ioutil.ReadDir(dir)
	if err != nil {
		return nil, err
	}
	var wl []string
	for _, fi := range rl {
		path := filepath.Join(dir, fi.Name())

		// follow symlinks
		if (fi.Mode() & os.ModeSymlink) != 0 {
			if fi, err = oswrap.Stat(path); err != nil {
				return nil, err
			}
		}
		if !fi.IsDir() {
			wl = append(wl, path)
			continue
		}
{'fraction_non_alphanumeric': 0.10735712030312598, 'fraction_numerical': 0.005683612251341964, 'mean_word_length': 3.7142857142857144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4508997', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1030, 'n_words': 400}