<commit_before>// Package snapshot provides the snapshoting functionality to goreleaser.
package snapshot

import (
	"fmt"

	"github.com/goreleaser/goreleaser/internal/pipe"
	"github.com/goreleaser/goreleaser/internal/tmpl"
	"github.com/goreleaser/goreleaser/pkg/context"
	"github.com/pkg/errors"
)

// Pipe for checksums
type Pipe struct{}

func (Pipe) String() string {
	return "snapshoting"
}

// Default sets the pipe defaults
func (Pipe) Default(ctx *context.Context) error {
	if ctx.Config.Snapshot.NameTemplate == "" {
		ctx.Config.Snapshot.NameTemplate = "{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}"
	}
	return nil
}

func (Pipe) Run(ctx *context.Context) error {
	if !ctx.Snapshot {
		return pipe.Skip("not a snapshot")
	}
	name, err := tmpl.New(ctx).Apply(ctx.Config.Snapshot.NameTemplate)
	if err != nil {
		return errors.Wrap(err, "failed to generate snapshot name")
	}
	if name == "" {
		return fmt.Errorf("empty snapshot name")
	}
	ctx.Version = name
	return nil
}
<commit_msg>fix: correct the spelling of "snapshotting" (#1450)<commit_after>// Package snapshot provides the snapshotting functionality to goreleaser.
package snapshot

import (
	"fmt"

	"github.com/goreleaser/goreleaser/internal/pipe"
	"github.com/goreleaser/goreleaser/internal/tmpl"
	"github.com/goreleaser/goreleaser/pkg/context"
	"github.com/pkg/errors"
)

// Pipe for checksums
type Pipe struct{}

func (Pipe) String() string {
	return "snapshotting"
}

// Default sets the pipe defaults
func (Pipe) Default(ctx *context.Context) error {
	if ctx.Config.Snapshot.NameTemplate == "" {
		ctx.Config.Snapshot.NameTemplate = "{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}"
	}
	return nil
}

func (Pipe) Run(ctx *context.Context) error {
	if !ctx.Snapshot {
		return pipe.Skip("not a snapshot")
	}
	name, err := tmpl.New(ctx).Apply(ctx.Config.Snapshot.NameTemplate)
	if err != nil {
		return errors.Wrap(err, "failed to generate snapshot name")
	}
	if name == "" {
		return fmt.Errorf("empty snapshot name")
	}
	ctx.Version = name
	return nil
}

{'fraction_non_alphanumeric': 0.13902681231380337, 'fraction_numerical': 0.0019860973187686196, 'mean_word_length': 4.261096605744125, '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': '2536198', 'n_tokens_mistral': 718, 'n_tokens_neox': 708, 'n_words': 168}