Skip to content

Commit 2661991

Browse files
committed
Merge pull request reactjs#76 from mttrs/lint-go-ruby
Lint for go and ruby
2 parents 83e0ff4 + 0138d00 commit 2661991

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func handleComments(w http.ResponseWriter, r *http.Request) {
5757
switch r.Method {
5858
case "POST":
5959
// Decode the JSON data
60-
comments := make([]comment, 0)
60+
var comments []comment
6161
if err := json.Unmarshal(commentData, &comments); err != nil {
6262
http.Error(w, fmt.Sprintf("Unable to Unmarshal comments from data file (%s): %s", dataFile, err), http.StatusInternalServerError)
6363
return

server.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
puts "Server started: http://localhost:#{port}/"
1717

1818
root = File.expand_path './public'
19-
server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root
19+
server = WEBrick::HTTPServer.new Port: port, DocumentRoot: root
2020

2121
server.mount_proc '/comments.json' do |req, res|
2222
comments = JSON.parse(File.read('./comments.json'))
@@ -28,7 +28,7 @@
2828
comment[key] = value.force_encoding('UTF-8')
2929
end
3030
comments << comment
31-
File.write('./comments.json', JSON.pretty_generate(comments, :indent => ' '))
31+
File.write('./comments.json', JSON.pretty_generate(comments, indent: ' '))
3232
end
3333

3434
# always return json
@@ -37,6 +37,6 @@
3737
res.body = JSON.generate(comments)
3838
end
3939

40-
trap 'INT' do server.shutdown end
40+
trap('INT') { server.shutdown }
4141

4242
server.start

0 commit comments

Comments
 (0)