<commit_before>package main

func init() {
	addTestCases(errgoMaskTests, errgoMask)
	addTestCases(errgoCauseTests, errgoCause)
}

var errgoMaskTests = []testCase{{
	Name: "errgo-mask.0",
	In: `package main

import (
	"errors"
	"fmt"
	"github.com/errgo/errgo"
	gc "launchpad.net/gocheck"
)

var errSomething = errors.New("foo")

func f() error {
	if err := foo(); err != nil {
		return fmt.Errorf("failure: %v", err)
	}
	errgo.New("foo: %s, %s", arg1, arg2)
	errgo.Annotate(err, "blah")
	errgo.Annotatef(err, "blah: %s, %s", arg1, arg2)
	return fmt.Errorf("cannot something: %s, %s", x, y)
}

func wrapper() (int, error) {
	if x, err := foo(); err != nil {
		return 0, err
	}
	if err := foo(); err != nil {
		return 0, err // A comment
	}
	return 24, nil
}
`,
	Out: `package main

import (
	"fmt"
	"launchpad.net/errgo/v2/errors"
	gc "launchpad.net/gocheck"
)

var errSomething = errors.New("foo")

func f() error {
	if err := foo(); err != nil {
		return errors.Notef(err, "failure")
	}
	errors.Newf("foo: %s, %s", arg1, arg2)
	errors.NoteMask(err, "blah")
	errors.Notef(err, "blah: %s, %s", arg1, arg2)
	return errors.Newf("cannot something: %s, %s", x, y)
}

func wrapper() (int, error) {
	if x, err := foo(); err != nil {
		return 0, errors.Mask(err)
	}
	if err := foo(); err != nil {
		return 0, errors. // A comment
					Mask(err)
	}
	return 24, nil
}
`,<commit_msg>exp/cmd/errfix: illustrate comment problem more realistically<commit_after>package main

func init() {
	addTestCases(errgoMaskTests, errgoMask)
	addTestCases(errgoCauseTests, errgoCause)
}

var errgoMaskTests = []testCase{{
	Name: "errgo-mask.0",
	In: `package main

import (
	"errors"
	"fmt"
	"github.com/errgo/errgo"
	gc "launchpad.net/gocheck"
)

var errSomething = errors.New("foo")

func f() error {
	if err := foo(); err != nil {
		return fmt.Errorf("failure: %v", err)
	}
	errgo.New("foo: %s, %s", arg1, arg2)
	errgo.Annotate(err, "blah")
	errgo.Annotatef(err, "blah: %s, %s", arg1, arg2)
	return fmt.Errorf("cannot something: %s, %s", x, y)
}

func wrapper() (int, error) {
	if x, err := foo(); err != nil {
		return 0, err
	}
	if err := foo(); err != nil {
		return 0, err
	}
	// A comment
	return 24, nil
}
`,
	Out: `package main

import (
	"fmt"
	"launchpad.net/errgo/v2/errors"
	gc "launchpad.net/gocheck"
)

var errSomething = errors.New("foo")

func f() error {
	if err := foo(); err != nil {
		return errors.Notef(err, "failure")
	}
	errors.Newf("foo: %s, %s", arg1, arg2)
	errors.NoteMask(err, "blah")
	errors.Notef(err, "blah: %s, %s", arg1, arg2)
	return errors.Newf("cannot something: %s, %s", x, y)
}

func wrapper() (int, error) {
	if x, err := foo(); err != nil {
		return 0, errors.Mask(err)
	}
	if err := foo(); err != nil {
		return 0, errors.Mask(

			// A comment
			err)
	}

	return 24, nil
}
`,
{'fraction_non_alphanumeric': 0.1879026485325698, 'fraction_numerical': 0.012884753042233358, 'mean_word_length': 3.753401360544218, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7030776', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1160, 'n_words': 309}