<commit_before>require 'guard'
require 'guard/guard'
require 'guard/watcher'
require 'guard/go/runner'

module Guard
  class Go < Guard::Guard 
    attr_reader :options

    DEFAULT_OPTIONS = {
        :go_file => 'app.go'
    }
    
    def initialize(watchers = [], options = {})
      super(watchers, options)

      @options = DEFAULT_OPTIONS.merge(options)
      @runner = ::Guard::RackRunner.new(@options)
    end

    # Call once when Guard starts. Please override initialize method to init stuff.
    # @raise [:task_has_failed] when start has failed
    def start
      run_all if options[:all_on_start]
    end

    def run_all
      run_on_change(Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq))
    end

    def run_on_change(paths)
      UI.info "Restarting Go..."
      if @runner.restart
        UI.info "Go restarted, pid #{runner.pid}"
      else
        UI.info "Go NOT restarted, check your log files."
      end
    end<commit_msg>Guard superclass<commit_after>require 'guard'
require 'guard/guard'
require 'guard/watcher'
require 'guard/go/runner'

module Guard
  class Go < ::Guard::Guard 
    attr_reader :options

    DEFAULT_OPTIONS = {
        :go_file => 'app.go'
    }
    
    def initialize(watchers = [], options = {})
      super(watchers, options)

      @options = DEFAULT_OPTIONS.merge(options)
      @runner = ::Guard::RackRunner.new(@options)
    end

    # Call once when Guard starts. Please override initialize method to init stuff.
    # @raise [:task_has_failed] when start has failed
    def start
      run_all if options[:all_on_start]
    end

    def run_all
      run_on_change(Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq))
    end

    def run_on_change(paths)
      UI.info "Restarting Go..."
      if @runner.restart
        UI.info "Go restarted, pid #{runner.pid}"
      else
        UI.info "Go NOT restarted, check your log files."
      end
    end
{'fraction_non_alphanumeric': 0.11844155844155844, 'fraction_numerical': 0.0, 'mean_word_length': 2.703846153846154, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4898083', 'n_tokens_mistral': 620, 'n_tokens_neox': 609, 'n_words': 160}