move http module to net.http

pull/3270/head
Abdullah Atta 2019-12-30 09:42:23 +05:00 committed by Alexander Medvednikov
parent 6cee50afda
commit 63b70ddb06
15 changed files with 14 additions and 9 deletions

View File

@ -14,8 +14,8 @@ jobs:
run: make -j4 run: make -j4
- name: Build a production tools/vfmt - name: Build a production tools/vfmt
run: ./v -prod -d vfmt tools/vfmt.v run: ./v -prod -d vfmt tools/vfmt.v
- name: fmt only the changed files (from master) - name: Run v fmt -diff on only the changed files. Does NOT fail for now.
run: git diff --name-status origin/master HEAD -- '*.v' |grep -v '^D'|rev|cut -f1|rev| xargs ./v fmt -diff run: git diff --name-status origin/master HEAD -- '*.v' |grep -v '^D'|rev|cut -f1|rev| xargs ./v fmt -noerror -diff
- name: Run v test-fmt - name: Run v test-fmt
run: ./v test-fmt run: ./v test-fmt

View File

@ -1,4 +1,4 @@
import http import net.http
fn main() { fn main() {
html := http.get_text('https://news.ycombinator.com') html := http.get_text('https://news.ycombinator.com')

View File

@ -1,7 +1,7 @@
// Copyright (c) 2019 Alexander Medvednikov. All rights reserved. // Copyright (c) 2019 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license // Use of this source code is governed by an MIT license
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
import http import net.http
import json import json
import sync import sync

View File

@ -19,6 +19,7 @@ struct FormatOptions {
is_all bool is_all bool
is_worker bool is_worker bool
is_debug bool is_debug bool
is_noerror bool
} }
const ( const (
@ -44,6 +45,7 @@ fn main() {
is_all: '-all' in args || '--all' in args is_all: '-all' in args || '--all' in args
is_worker: '-worker' in args is_worker: '-worker' in args
is_debug: '-debug' in args is_debug: '-debug' in args
is_noerror: '-noerror' in args
} }
if foptions.is_verbose { if foptions.is_verbose {
eprintln('vfmt foptions: $foptions') eprintln('vfmt foptions: $foptions')
@ -104,6 +106,9 @@ fn main() {
} }
if errors > 0 { if errors > 0 {
eprintln('Encountered a total of: ${errors} errors.') eprintln('Encountered a total of: ${errors} errors.')
if foptions.is_noerror {
exit(0)
}
exit(1) exit(1)
} }
} }

View File

@ -1,7 +1,7 @@
module main module main
import ( import (
http net.http
os os
json json
filepath filepath

View File

@ -6,7 +6,7 @@ module http
import os import os
pub fn download_file(url, out string) bool { pub fn download_file(url, out string) bool {
s := http.get(url) or { s := get(url) or {
return false return false
} }
os.write_file(out, s.text) os.write_file(out, s.text)

View File

@ -4,7 +4,7 @@
module http module http
import net.urllib import net.urllib
import http.chunked import net.http.chunked
const ( const (
max_redirects = 4 max_redirects = 4

View File

@ -1,5 +1,5 @@
// import net.urllib // import net.urllib
import http import net.http
fn test_escape_unescape() { fn test_escape_unescape() {
/* /*

View File

@ -7,7 +7,7 @@ module vweb
import ( import (
os os
net net
http net.http
net.urllib net.urllib
strings strings
) )